Skip to content

Instantly share code, notes, and snippets.

@ignu
Created September 12, 2009 16:01
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 ignu/185888 to your computer and use it in GitHub Desktop.
Save ignu/185888 to your computer and use it in GitHub Desktop.
Scenario: Log in
Given I am registered as 'Tony' with password 'ABC123'
When I go to the login page
And I fill in "username" with "Tony"
And I fill in "password" with "ABC123"
And I press "submit"
Then I should be on the survey start page
# Works!
# Refactored to:
Scenario: Log in
Given I am registered as 'Tony' with password 'ABC123'
When I login with 'Tony' and 'ABC123'
Then I should be on the survey start page
def login_with(username, password)
visit '/login'
fill_in('username', username) #doesn't seem to work
fill_in('password', password) #doesn't seem to work
click_button('submit')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment