Skip to content

Instantly share code, notes, and snippets.

@pedromtavares
Created September 29, 2010 01:38
Show Gist options
  • Save pedromtavares/602159 to your computer and use it in GitHub Desktop.
Save pedromtavares/602159 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/acceptance_helper'
feature "Login", %q{
In order to be able to use the application
As a user
I want to be able to login
} do
background do
Factory(:user, :login => 'default', :name => 'Default')
end
scenario "Login required" do
visit homepage
page.should have_content("You need to sign in or sign up before continuing.")
end
scenario "Login sucessfully" do
logged_in_as_default
page.should have_content("Signed in successfully.") and page.should have_content("Logged in as default")
current_path.should == homepage
end
scenario "Login failed" do
visit login_path
fill_in("Login", :with => "default")
fill_in("Password", :with => "654321")
click_button("Login")
page.should have_content("Invalid login or password.")
current_path.should == login_path
end
scenario "Logout" do
logged_in_as_default
click("Logout")
current_path.should == login_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment