Skip to content

Instantly share code, notes, and snippets.

@mfurtak
Created January 31, 2011 01:37
Show Gist options
  • Save mfurtak/803516 to your computer and use it in GitHub Desktop.
Save mfurtak/803516 to your computer and use it in GitHub Desktop.
Feature: Managing a user session
In order to manage my session with the site
As a user
I should be able to sign in and sign out
Scenario: Navigate to the sign in page
Given I am not signed in
And I am on the home page
When I follow "Sign in"
Then I should be on the new user session page
Scenario: Try to sign in without entering credentials
Given I am not signed in
And I am on the new user session page
When I press "Sign in"
Then there should be a flash alert
Scenario: Try to sign in with an improperly formatted email
Given I am not signed in
And I am on the new user session page
When I fill in "Email" with "invalid.com"
When I fill in "Password" with "whatever"
When I press "Sign in"
Then there should be a flash alert
Scenario: Try to sign in with an invalid email/password pair
Given I am not signed in
And I am on the new user session page
When I fill in "Email" with "invalid@whatever.com"
When I fill in "Password" with "whatever"
When I press "Sign in"
Then there should be a flash alert
Scenario: Try to sign in with valid credentials
Given I am not signed in
And I signed up with "me@valid.com/mypassword"
And I am on the new user session page
When I fill in "Email" with "me@valid.com"
And I fill in "Password" with "mypassword"
And I press "Sign in"
Then there should be a flash notice
And I should be on the dashboard page
Scenario: Try to log out
Given I am signed in as "me@valid.com/mypassword"
When I follow "Sign out"
Then there should be a flash notice
And I should be on the home page
And I should see "Sign in"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment