Skip to content

Instantly share code, notes, and snippets.

@piotrze
Created June 26, 2012 09:07
Show Gist options
  • Save piotrze/2994577 to your computer and use it in GitHub Desktop.
Save piotrze/2994577 to your computer and use it in GitHub Desktop.
Rspec helper for sign_in with clearance and facebook-omniauth
#spec/support/prefork/request_helpers.rb
module RequestHelpers
def sign_in_as(user, password = "password")
OmniAuth.config.add_mock(:facebook, {"uid" => user.facebook_uid})
visit root_path
click_link "Sign in"
ensure_signed_in
end
def ensure_signed_in
visit root_path
wait_until {page.should have_content "Sign out"}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment