Skip to content

Instantly share code, notes, and snippets.

@johanb
Created May 5, 2011 08:55
Show Gist options
  • Save johanb/956753 to your computer and use it in GitHub Desktop.
Save johanb/956753 to your computer and use it in GitHub Desktop.
## Features
Feature: Authentication
In order to use GoGo app
As a visitor
I want to be able to log in
Scenario: Login
Given I am not logged in
When I follow "Sign in with Facebook"
And I allow authentication
Then I should see "Signed in succesfully."
Scenario: Failed login
Given I am not logged in
When I follow "Sign in with Facebook"
And I disallow authentication
Then I should see "Sorry, there was something wrong with your login attempt. Please try again."
## Steps
When /^I disallow authentication$/ do
OmniAuth.config.mock_auth[:facebook] = :invalid_credentials
end
## Controller
def failure
redirect_to root_url, :alert => 'Sorry, there was something wrong with your login attempt. Please try again.'
end
## Auth
match '/auth/failure' => 'sessions#failure'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment