Guest User

Untitled

a guest
Jan 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. require "authlogic/test_case"
  2.  
  3. World(Authlogic::TestCase)
  4.  
  5. Before do
  6. @cookies = ActionDispatch::Cookies::CookieJar.new(Rails.application.config.secret_token)
  7.  
  8. Authlogic::TestCase::MockCookieJar.stub(:new).and_return{ @cookies }
  9. ActionDispatch::Request.any_instance.stub(:cookies).and_return{ @cookies }
  10. ActionDispatch::Request.any_instance.stub(:cookie_jar).and_return{ @cookies }
  11.  
  12. activate_authlogic
  13. end
  14.  
  15. def current_user
  16. UserSession.find.try(:record)
  17. end
Add Comment
Please, Sign In to add comment