I've created a module so I can quickly create users, sign in as users, delete users and sign out users. Here is a simplified example:
module UserAuth
def sign_in(user)
cookies.permanent[:remember_token] = 'asda'
end
end
However, if I run this spec:
describe 'UserAuth' do
include UserAuth
context 'signed up' do
let(:user_1) { FactoryGirl.build(:user) }
before { sign_up user_1 }
contex 'signed in' do
before { sign_in user_1 }
it {}
end
end
end
I get this error:
undefined method `permanent' for #<Rack::Test::CookieJar:#>
What I find weird about this is that cookies
object is available, but this permanent
method isn't for some reason. Can I resolve this issue by simply including another module in the UserAuth module? If so, what is the name of this module?