In my spec_helper.rb I've added
config.include Devise::TestHelpers, :type => :controller
In controller spec before :all hook I'am trying to sign in user with this code
@request.env["devise.mapping"] = Devise.mappings[:user]
user = FactoryGirl.create(:confirmed_user)
sign_in user
and get NoMethodError: undefined method `env' for nil:NilClass.
Any ideas?
I've changed before(:all)
to before(:each)
, and now it works. Looks like API incompatibility between devise
(used github
master branch) and rspec
2.14.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With