Skip to content

Instantly share code, notes, and snippets.

@kristianhellquist
Created March 30, 2011 13:22
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 kristianhellquist/894366 to your computer and use it in GitHub Desktop.
Save kristianhellquist/894366 to your computer and use it in GitHub Desktop.
Cucumber: Sessions
Feature: User session creation
As a member
I want to log in
So that I get access to member functionality
Scenario: Not registred
Given I am on the login page
When I fill in the following:
| Email | foo@bar.com |
| Password | secret |
And I press "Log in"
Then I should see "is not valid"
Scenario: Blank form
Given I am on the login page
When I press "Log in"
Then I should see "You did not provide any details for authentication"
Scenario: Incorrect password
Given a user with email "foo@bar.com" exists
And I am on the login page
When I fill in the following:
| Email | foo@bar.com |
| Password | wrong_password |
And I press "Log in"
Then I should see "is not valid"
Scenario: Successful log in
Given I have an account with email "foo@bar.com" and password "secret"
And I am on the login page
When I fill in the following:
| Email | foo@bar.com |
| Password | secret |
And I press "Log in"
Then I should be logged in
And I should see the profile form
And I should not see "Sign up"
Scenario: Already logged in
Given I am registered and log in with email "foo@bar.com"
When I go to the login page
Then I should see "You need to log out first"
@javascript
Scenario: Following "Log in"
Given I am on the home page
When I follow "Log in"
Then I should see the login form
Scenario: Redirected when logging in
Given I have an account with email "foo@bar.com" and password "secret"
When I go to the profile page
Then I should see "You need to log in first"
And I should see "Email"
And I should see "Password"
When I fill in the following:
| Email | foo@bar.com |
| Password | secret |
And I press "Log in"
Then I should see the profile form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment