Skip to content

Instantly share code, notes, and snippets.

@laserlemon
Created September 26, 2011 16:09
Show Gist options
  • Select an option

  • Save laserlemon/1242604 to your computer and use it in GitHub Desktop.

Select an option

Save laserlemon/1242604 to your computer and use it in GitHub Desktop.
Cucumber ♡ Authlogic
require "authlogic/test_case"
World(Authlogic::TestCase)
Before do
@cookies = ActionDispatch::Cookies::CookieJar.new(Rails.application.config.secret_token)
Authlogic::TestCase::MockCookieJar.stub(:new).and_return{ @cookies }
ActionDispatch::Request.any_instance.stub(:cookies).and_return{ @cookies }
ActionDispatch::Request.any_instance.stub(:cookie_jar).and_return{ @cookies }
activate_authlogic
end
def current_user
UserSession.find.try(:record)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment