testdouble / jasmine-rails

A Jasmine runner for rails projects that's got you covered in both the terminal and the browser
http://rubygems.org/gems/jasmine-rails
MIT License
378 stars 154 forks source link

Clear Rails 5 Deprecation warnings #187

Closed searls closed 7 years ago

searls commented 8 years ago

Here's what I see when I run under Rails 5 right now:

DEPRECATION WARNING: Accessing mime types via constants is deprecated. Please change `Mime::JSON` to `Mime[:json]`. (called from <top (required)> at /Users/justin/code/searls/jr5/config/application.rb:12)
DEPRECATION WARNING: Accessing mime types via constants is deprecated. Please change `Mime::JSON` to `Mime[:json]`. (called from <top (required)> at /Users/justin/code/searls/jr5/config/application.rb:12)
DEPRECATION WARNING: `static_cache_control` is deprecated and will be removed in Rails 5.1.
Please use
`config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }`
instead.
 (called from block in <top (required)> at /Users/justin/code/searls/jr5/config/environments/test.rb:17)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /Users/justin/code/searls/jr5/config/environment.rb:5)
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from override_rails_config at /Users/justin/code/searls/jasmine-rails/lib/jasmine_rails/runner.rb:47)
DEPRECATION WARNING: after_filter is deprecated and will be removed in Rails 5.1. Use after_action instead. (called from override_rails_config at /Users/justin/code/searls/jasmine-rails/lib/jasmine_rails/runner.rb:47)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from block in <module:OfflineAssetPaths> at /Users/justin/code/searls/jasmine-rails/lib/jasmine_rails/offline_asset_paths.rb:13)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from block in <module:OfflineAssetPaths> at /Users/justin/code/searls/jasmine-rails/lib/jasmine_rails/offline_asset_paths.rb:16)
DEPRECATION WARNING: ActionDispatch::IntegrationTest HTTP request methods will accept only
the following keyword arguments in future Rails versions:
params, headers, env, xhr

Examples:

get '/profile',
  params: { id: 1 },
  headers: { 'X-Extra-Header' => '123' },
  env: { 'action_dispatch.custom' => 'custom' },
  xhr: true
. (called from get_spec_runner at /Users/justin/code/searls/jasmine-rails/lib/jasmine_rails/runner.rb:61)
Running `"/Users/justin/.phantomjs/2.1.1/darwin/bin/phantomjs" "" "/Users/justin/code/searls/jasmine-rails/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "file:///Users/justin/code/searls/jr5/tmp/jasmine/runner.html?spec="`
Running: file:///Users/justin/code/searls/jr5/tmp/jasmine/runner.html?spec=
Starting...

Finished
-----------------
2 specs, 0 failures in 0.027s.

ConsoleReporter finished

That is a LOT of deprecation warnings.

searls commented 8 years ago

Ok folks, real talk: I haven't used jasmine-rails myself for well over 4 years at this point, and while these deprecation warnings in Rails 5 should be dealt with, I just don't have the time or caremad to deal with them. Applying the cry-for-help label for any users interested in figuring out how to address the deprecation warnings in a way that doesn't break support for Rails 3.2 & up or Ruby 1.9.

Gauntlet: lain.

derekprior commented 8 years ago

Are you prepared to bump the major version to fix some of these deprecations or would you prefer not to? before_filter for instance, can be updated to before_action but then you lose compatibility with Rails 3.

I did this ridiculousness in lots of places because I wasn't quite ready to drop 3.x support: https://github.com/thoughtbot/clearance/blob/master/app/controllers/clearance/users_controller.rb#L2-L10

Sounds like it might not be quite so bad in jasmine-rails' case as it looks like there's only one controller generating filter warnings.

searls commented 8 years ago

@derekprior because there is so little code in this library, I think maintaining existing support is feasible (and I know a lot of users are on very old projects).

If the if-else branching gets much worse, one option would be to define multiple ruby files for each major Rails version and just load them conditionally on a version check

chrisarcand commented 8 years ago

Was about to suggest your solution there @derekprior :) It's not too bad with a conditional send ¯_(ツ)_/¯

benlovell commented 8 years ago

198 removes another outstanding deprecation.

searls commented 7 years ago

@benlovell merged

@chrisarcand could I recruit you to try to whack whatever deprecation warnings that remain using this sort of branching method? It'd be nice to have a consistent approach for switching based on rails version rather than littering rails constants all over duplicatively

chrisarcand commented 7 years ago

@searls Sure

On Saturday, September 10, 2016, Justin Searls notifications@github.com wrote:

@benlovell https://github.com/benlovell merged

@chrisarcand https://github.com/chrisarcand could I recruit you to try to whack whatever deprecation warnings that remain using this sort of branching method? It'd be nice to have a consistent approach for switching based on rails version rather than littering rails constants all over duplicatively

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/searls/jasmine-rails/issues/187#issuecomment-246087555, or mute the thread https://github.com/notifications/unsubscribe-auth/ACUWGmfhQulVTQy390pqkmSA8raF1zCcks5qoi6kgaJpZM4ICeOU .

Chris Arcand @chrisarcand

searls commented 7 years ago

Landed in 0.14.1