Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPRECATION WARNING: named_routes.helpers is deprecated, please use route_defined?(route_name) to see if a named route was defined. (called from block in it_requires_authentication #1187

Closed
Vorob-Astronaut opened this issue Oct 7, 2014 · 8 comments

Comments

@Vorob-Astronaut
Copy link

Hi guys. I wrote rspec spec And I had:

DEPRECATION WARNING: `named_routes.helpers` is deprecated, please use `route_defined?(route_name)` to see if a named route was defined. (called from block in it_requires_authentication at /Users/vorob/Dropbox/ruby/upnetwork/spec/support/controllers/errors_helper.rb:7)

See my /Users/vorob/Dropbox/ruby/upnetwork/spec/support/controllers/errors_helper.rb

module Controllers
  module ErrorsHelper
    def it_requires_authentication(&block)
      it 'requires authentication' do
        instance_exec(&block)

        expect(response).not_to be_successful
        expect(flash[:alert]).to eq(I18n.t('devise.failure.unauthenticated'))
      end
    end

    def it_raises_authorization_error(in_case = nil, &block)
      it "raises authorization error #{in_case}" do
        instance_exec(&block)

        expect(response).not_to be_successful
        expect(flash[:alert]).to eq(I18n.t('errors.not_authorized'))
      end
    end
  end
end

I use

  gem 'rspec-rails', '~> 3.0'
@cupakromer
Copy link
Member

Could you please add your exact RSpec, Rails, and Ruby versions?

@cupakromer
Copy link
Member

Looks related to #1142. Rails 4.2 support starts with rspec-rails 3.1, please make sure you're using this setup.

@Vorob-Astronaut
Copy link
Author

I changed version from 3.0 to 3.1 and it works fine.

gem 'rspec-rails', '~> 3.1'

Tnx)

@JonRowe
Copy link
Member

JonRowe commented Oct 7, 2014

@cupakromer do you think it would be an idea to issue a warning when using Rails 4.2 on 3.0?

@cupakromer
Copy link
Member

@JonRowe i would like to do something. We could put the warning in, we also could update the gemspec too. I'm not sure what's best or better long term.

derekprior added a commit to thoughtbot/clearance that referenced this issue Dec 20, 2014
Most of the changes necessary here were test-suite-only issues. The lone
production-impactful change was adding support for
`ActionMailer#deliver_later` in the `PasswordsController`. This will
automatically use the queue configured with Active Job in order to
background the sending of email. With no queue configured, it will be
delivered synchronously. The old `#deliver` method still works, but
generates deprecation warnings.

The rest of the changes were related to the test suite:
* Add a Rails 4.2 appraisal
* Update cucumber steps to remove unnecessary gems from generated apps.
* Simplify appraisal dependencies thanks to the above.
* Fixed `forgeries_controller_spec`. This is still a brittle way to test
  this functionality but at least it works across Rails versions.
* Removed deprecation related to test suite ordering in the test app
  that is loaded.

There remains a single (repeated) deprecation when running specs on 4.2
which comes from RSpec and will be addressed by upgrading to
`rspec-rails` 3.1 (see [`rspec-rails` issue]. That work will be in a
separate pull-request.

[`rspec-rails` issue]: rspec/rspec-rails#1187
derekprior added a commit to thoughtbot/clearance that referenced this issue Dec 20, 2014
Most of the changes necessary here were test-suite-only issues. The lone
production-impactful change was adding support for
`ActionMailer#deliver_later` in the `PasswordsController`. This will
automatically use the queue configured with Active Job in order to
background the sending of email. With no queue configured, it will be
delivered synchronously. The old `#deliver` method still works, but
generates deprecation warnings.

The rest of the changes were related to the test suite:
* Add a Rails 4.2 appraisal
* Update cucumber steps to remove unnecessary gems from generated apps.
* Simplify appraisal dependencies thanks to the above.
* Fixed `forgeries_controller_spec`. This is still a brittle way to test
  this functionality but at least it works across Rails versions.
* Removed deprecation related to test suite ordering in the test app
  that is loaded.

There remains a single (repeated) deprecation when running specs on 4.2
which comes from RSpec and will be addressed by upgrading to
`rspec-rails` 3.1 (see [`rspec-rails` issue]. That work will be in a
separate pull-request.

[`rspec-rails` issue]: rspec/rspec-rails#1187
derekprior added a commit to thoughtbot/clearance that referenced this issue Dec 20, 2014
Most of the changes necessary here were test-suite-only issues. The lone
production-impactful change was adding support for
`ActionMailer#deliver_later` in the `PasswordsController`. This will
automatically use the queue configured with Active Job in order to
background the sending of email. With no queue configured, it will be
delivered synchronously. The old `#deliver` method still works, but
generates deprecation warnings.

The rest of the changes were related to the test suite:
* Add a Rails 4.2 appraisal
* Update cucumber steps to remove unnecessary gems from generated apps.
* Simplify appraisal dependencies thanks to the above.
* Fixed `forgeries_controller_spec`. This is still a brittle way to test
  this functionality but at least it works across Rails versions.
* Removed deprecation related to test suite ordering in the test app
  that is loaded.

There remains a single (repeated) deprecation when running specs on 4.2
which comes from RSpec and will be addressed by upgrading to
`rspec-rails` 3.1 (see [`rspec-rails` issue]. That work will be in a
separate pull-request.

[`rspec-rails` issue]: rspec/rspec-rails#1187
derekprior added a commit to thoughtbot/clearance that referenced this issue Dec 20, 2014
Most of the changes necessary here were test-suite-only issues. The lone
production-impactful change was adding support for
`ActionMailer#deliver_later` in the `PasswordsController`. This will
automatically use the queue configured with Active Job in order to
background the sending of email. With no queue configured, it will be
delivered synchronously. The old `#deliver` method still works, but
generates deprecation warnings.

The rest of the changes were related to the test suite:
* Add a Rails 4.2 appraisal
* Update cucumber steps to remove unnecessary gems from generated apps.
* Simplify appraisal dependencies thanks to the above.
* Fixed `forgeries_controller_spec`. This is still a brittle way to test
  this functionality but at least it works across Rails versions.
* Removed deprecation related to test suite ordering in the test app
  that is loaded.

There remains a single (repeated) deprecation when running specs on 4.2
which comes from RSpec and will be addressed by upgrading to
`rspec-rails` 3.1 (see [`rspec-rails` issue]. That work will be in a
separate pull-request.

[`rspec-rails` issue]: rspec/rspec-rails#1187
derekprior added a commit to thoughtbot/clearance that referenced this issue Dec 20, 2014
Most of the changes necessary here were test-suite-only issues. The lone
production-impactful change was adding support for
`ActionMailer#deliver_later` in the `PasswordsController`. This will
automatically use the queue configured with Active Job in order to
background the sending of email. With no queue configured, it will be
delivered synchronously. The old `#deliver` method still works, but
generates deprecation warnings.

The rest of the changes were related to the test suite:
* Add a Rails 4.2 appraisal
* Update cucumber steps to remove unnecessary gems from generated apps.
* Simplify appraisal dependencies thanks to the above.
* Fixed `forgeries_controller_spec`. This is still a brittle way to test
  this functionality but at least it works across Rails versions.
* Removed deprecation related to test suite ordering in the test app
  that is loaded.

There remains a single (repeated) deprecation when running specs on 4.2
which comes from RSpec and will be addressed by upgrading to
`rspec-rails` 3.1 (see [`rspec-rails` issue]. That work will be in a
separate pull-request.

[`rspec-rails` issue]: rspec/rspec-rails#1187
derekprior added a commit to thoughtbot/clearance that referenced this issue Dec 20, 2014
Most of the changes necessary here were test-suite-only issues. The lone
production-impactful change was adding support for
`ActionMailer#deliver_later` in the `PasswordsController`. This will
automatically use the queue configured with Active Job in order to
background the sending of email. With no queue configured, it will be
delivered synchronously. The old `#deliver` method still works, but
generates deprecation warnings.

The rest of the changes were related to the test suite:
* Add a Rails 4.2 appraisal
* Update cucumber steps to remove unnecessary gems from generated apps.
* Simplify appraisal dependencies thanks to the above.
* Fixed `forgeries_controller_spec`. This is still a brittle way to test
  this functionality but at least it works across Rails versions.
* Removed deprecation related to test suite ordering in the test app
  that is loaded.

There remains a single (repeated) deprecation when running specs on 4.2
which comes from RSpec and will be addressed by upgrading to
`rspec-rails` 3.1 (see [`rspec-rails` issue]. That work will be in a
separate pull-request.

[`rspec-rails` issue]: rspec/rspec-rails#1187
derekprior added a commit to thoughtbot/clearance that referenced this issue Dec 20, 2014
Most of the changes necessary here were test-suite-only issues. The lone
production-impactful change was adding support for
`ActionMailer#deliver_later` in the `PasswordsController`. This will
automatically use the queue configured with Active Job in order to
background the sending of email. With no queue configured, it will be
delivered synchronously. The old `#deliver` method still works, but
generates deprecation warnings.

The rest of the changes were related to the test suite:
* Add a Rails 4.2 appraisal
* Update cucumber steps to remove unnecessary gems from generated apps.
* Simplify appraisal dependencies thanks to the above.
* Fixed `forgeries_controller_spec`. This is still a brittle way to test
  this functionality but at least it works across Rails versions.
* Removed deprecation related to test suite ordering in the test app
  that is loaded.

There remains a single (repeated) deprecation when running specs on 4.2
which comes from RSpec and will be addressed by upgrading to
`rspec-rails` 3.1 (see [`rspec-rails` issue]. That work will be in a
separate pull-request.

[`rspec-rails` issue]: rspec/rspec-rails#1187
alxndr added a commit to alxndr/lyrem-ipsum that referenced this issue Dec 21, 2014
iamkhushbajwa pushed a commit to iamkhushbajwa/active_model_form_objects that referenced this issue Jan 22, 2015
A deprecation warning on `named_routes.helpers` occurred, however, by
bumping the version of `rspec-rails` to 3.1 fixed the issue
(rspec/rspec-rails#1187)
@arthurnn
Copy link

is this on rspec 2 too?

@cupakromer
Copy link
Member

@arthurnn it is not, we are not supporting Rails 4.2 on RSpec 2. If you are looking for help upgrading to RSpec 3 check out the main upgrade guide the rails specific changes and the amazing tool transpec which automates a huge portion of the process.

@arthurnn
Copy link

@cupakromer thanks. I will do that.

issyl0 pushed a commit to alphagov/short-url-manager that referenced this issue May 12, 2015
- Bump activerecord-session_store to fix this deprecation warning:
  rails/activerecord-session_store#36.
- Bump rspec-rails to fix this deprecation warning:
  rspec/rspec-rails#1187.
issyl0 pushed a commit to alphagov/short-url-manager that referenced this issue May 12, 2015
- Bump activerecord-session_store to fix this deprecation warning:
  rails/activerecord-session_store#36.
- Bump rspec-rails to fix this deprecation warning:
  rspec/rspec-rails#1187.
issyl0 pushed a commit to alphagov/short-url-manager that referenced this issue May 13, 2015
- Bump `activerecord-session_store` to fix this deprecation warning:
  rails/activerecord-session_store#36.
- Bump `rspec-rails` to fix this deprecation warning:
  rspec/rspec-rails#1187.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants