Skip to content

Instantly share code, notes, and snippets.

@distributedlife
Created April 21, 2012 00:44
Show Gist options
  • Save distributedlife/2432904 to your computer and use it in GitHub Desktop.
Save distributedlife/2432904 to your computer and use it in GitHub Desktop.
Feature: Who cares?
Scenario: valid user accounts can log in
When I have a valid user account
Then I can login
def create_valid_account
User.create(:username => 'scott', :password => 'tiger')
end
def login_user user
goto_page(:login_page) do | page|
page.login_with user
end
end
describe "Logging In" do
context "with a valid user" do
user = create_valid_user
login_user user
it "should log me in" do
user.logged_in?.should be_true
end
end
end
When /^I have a valid user account$/ do
@user = create_valid_account
end
Then /^I can login$/ do
login_user @user
@user.logged_in?.should be_true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment