Skip to content

Instantly share code, notes, and snippets.

@mariovisic
Created October 25, 2011 15:37
Show Gist options
  • Save mariovisic/1313163 to your computer and use it in GitHub Desktop.
Save mariovisic/1313163 to your computer and use it in GitHub Desktop.
Feature: Authentication (No Web Steps, Declarative)
As A User
In order to gain access to sknet
I want to be able to login and logout
Background:
Given I have a valid account
Then I should be able to login
module AuthenticationHelper
def fill_in_my_details
fill_in 'Email', :with => @current_email
fill_in 'Password', :with => @current_password
end
end
World(AuthenticationHelper)
Given /^I have a valid account$/ do
@current_email = '[email protected]'
@current_password = 'candles'
@current_user = FactoryGirl.create(:user, :email => @current_email, :password => @current_password)
end
Then /^I should be able to login$/ do
visit new_user_session_path
fill_in_my_details
click_button 'Sign in'
page.should have_content 'Signed in'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment