Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Created July 1, 2011 17:00
Show Gist options
  • Save guilleiguaran/1058943 to your computer and use it in GitHub Desktop.
Save guilleiguaran/1058943 to your computer and use it in GitHub Desktop.
require File.expand_path(File.dirname(__FILE__) + '/request_helper')
feature "Users sign in", %q{
In order to start using the page
As an anonymous user
I want sign in to my existing account
} do
background do
@user = Factory.create(:user)
end
scenario "I sign in on the page with a valid email/password" do
visit sign_in_page
fill_in 'user_login', :with => @user.email
fill_in 'user_password', :with => @user.password
click_button 'user_submit'
page.should have_content('Signed in successfully')
end
scenario "I sign in on the page with a valid username/password" do
visit sign_in_page
fill_in 'user_login', :with => @user.username
fill_in 'user_password', :with => @user.password
click_button 'user_submit'
page.should have_content('Signed in successfully')
end
scenario "I try to sign in on the page with a invalid email/password" do
visit sign_in_page
fill_in 'user_login', :with => @user.username
fill_in 'user_password', :with => 'invalid'
click_button 'user_submit'
page.should have_content('Invalid email or password')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment