Created
May 19, 2011 13:05
-
-
Save stve/980707 to your computer and use it in GitHub Desktop.
OmniAuth cukes
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
Feature: Authentication | |
In order to attract interest and users to Futureish | |
As a product development team | |
I want users to login via twitter | |
So that they can create a Futureish account | |
Scenario: Authentication via Twitter | |
Given I am logged in on twitter | |
When I go to the homepage | |
And I follow "Login with Twitter" | |
Then I should see "Dashboard" | |
And I should be on the dashboard page | |
And I should not see "Login with Twitter" | |
And I should see "You are logged in as:" | |
And I should see "Sign Out" | |
And a user account should be created | |
Scenario: Invalid Authentication | |
Given I am a random loser | |
When I go to the homepage | |
And I follow "Login with Twitter" | |
Then I should be on the homepage | |
And I should see "denied authorization" | |
And I should see "Login with Twitter" | |
And I should not see "Sign Out" | |
Scenario: Signout | |
Given I am logged in | |
And I should see "Sign Out" | |
When I follow "Sign Out" | |
Then I should be on the homepage | |
And I should see "Login with Twitter" | |
And I should not see "Sign Out" |
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
Given /^I am a random passerby$/ do | |
true | |
end | |
Given /^I am a random loser$/ do | |
OmniAuth.config.mock_auth[:twitter] = :authorization_denied | |
end | |
Given /^I am logged in$/ do | |
Given "I am logged in on twitter" | |
When "I go to the homepage" | |
And "I follow \"Login with Twitter\"" | |
end | |
Then /^I should be redirected to the dashboard$/ do | |
visit(root_path) | |
last_response.should be_redirect | |
end | |
Given /^I am logged in on twitter$/ do | |
OmniAuth.config.test_mode = true | |
OmniAuth.config.mock_auth[:twitter] = OMNIAUTH_TWITTER_HASH | |
end | |
Then /^a user account should be created$/ do | |
User.where(:uid => OMNIAUTH_TWITTER_HASH['uid']).first.should be | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Neat.