Created
July 21, 2010 17:16
-
-
Save nruth/484787 to your computer and use it in GitHub Desktop.
Testing login "remember me" feature with Capybara (rack::test or selenium) - deleting the session cookie (only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@javascript @announce | |
Scenario: remembering users so they don't have to log in again for a while | |
Given an activated member exists with forename: "Paul", surname: "Smith", email: "[email protected]", password: "bananabanana" | |
When I go to the dashboard | |
Then I should see "Existing Member Login" | |
When I fill in "Email" with "[email protected]" within "#member_login" | |
And I fill in "Password" with "bananabanana" within "#member_login" | |
And I check "Remember me" | |
And I press "Sign in" | |
Then I should be on the dashboard | |
And I should see "Logged in as Paul Smith" | |
And I should see "Sign out" | |
Given I close my browser (clearing the Medify session) | |
When I come back next time | |
And I go to the dashboard | |
Then I should see "Logged in as Paul Smith" | |
And I should see "Sign out" | |
@rack_test @announce | |
Scenario: don't remember users across browser restarts if they don't want it | |
Given an activated member exists with forename: "Paul", surname: "Smith", email: "[email protected]", password: "bananabanana" | |
When I go to the dashboard | |
Then I should see "Existing Member Login" | |
When I fill in "Email" with "[email protected]" within "#member_login" | |
And I fill in "Password" with "bananabanana" within "#member_login" | |
And I uncheck "Remember me" | |
And I press "Sign in" | |
Then I should be on the dashboard | |
And I should see "Logged in as Paul Smith" | |
And I should see "Sign out" | |
Given I close my browser (clearing the Medify session) | |
When I come back next time | |
And I go to the dashboard | |
Then I should see "Existing Member Login" | |
And I should not see "Logged in as Paul Smith" | |
And I should not see "Sign out" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A slightly cleaned-up version that also supports Webkit.
NOTES:
https://gist.github.com/4367281