Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 5 controller test changes - `Devise::TestHelpers` is deprecated and will be removed from Devise.'

I'm working on my first app since I installed Rails 5. When I ran my specs for controller actions, I got the warning message below even though all my tests were passing.

[Devise] including `Devise::TestHelpers` is deprecated and will be removed from Devise.    
For controller tests, please include `Devise::Test::ControllerHelpers` instead.

So in spec/rails_helper.rb I change this line:

config.include Devise::TestHelpers, type: :controller

to

config.include Devise::Test::ControllerHelpers

This change made the warning go away, but now the specs for models are failing. (They were passing before the change.) How should I fix this? Thanks!

like image 654
emico7 Avatar asked Jul 20 '16 16:07

emico7


1 Answers

You should change your spec/rails_helper.rb file to the following:

config.include Devise::Test::ControllerHelpers, type: :controller

This will ensure that the Devise::Test::ControllerHelpers module is only be included in your controller tests. The reason your model tests are failing is because that module is specific to controller tests.

like image 66
blowmage Avatar answered Nov 14 '22 04:11

blowmage