Skip to content

Instantly share code, notes, and snippets.

@djo
Created March 6, 2013 11:39
Show Gist options
  • Save djo/5098749 to your computer and use it in GitHub Desktop.
Save djo/5098749 to your computer and use it in GitHub Desktop.
Speed up capybara specs by setting user session directly in the app. To have access to the rack session use https://github.com/railsware/rack_session_access.
def fast_log_in
user = Factory.create(:user)
warden_key = User.serialize_into_session(user).unshift('User')
page.set_rack_session(:'warden.user.user.key' => warden_key)
user
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment