Skip to content

Instantly share code, notes, and snippets.

@yukas
Last active July 29, 2016 10:54
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 yukas/57353dbf98f8854b681d4d97773dc6bd to your computer and use it in GitHub Desktop.
Save yukas/57353dbf98f8854b681d4d97773dc6bd to your computer and use it in GitHub Desktop.
class LoginPage
include Capybara::DSL
include Rails.application.routes.url_helpers
def visit
super login_path
end
def login_with(params = {})
fill_login_form(params)
click_login
end
private
def fill_login_form(params = {})
within("#login-form") do
fill_in "login", with: params[:email]
fill_in "password", with: params[:password]
end
end
def click_login
click_button "Login"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment