Skip to content

Instantly share code, notes, and snippets.

@mtsmfm
Created May 15, 2013 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtsmfm/5580909 to your computer and use it in GitHub Desktop.
Save mtsmfm/5580909 to your computer and use it in GitHub Desktop.
feature spec でも request spec でも controller spec でも 同様にログインしたい
def sign_in(user)
case example.metadata[:type]
when :controller, :request
cookies[:remember_token] = user.remember_token
when :feature
visit signin_path
fill_in "Email", with: user.email.upcase
fill_in "Password", with: user.password
click_button "Sign in"
else
raise
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment