Created
April 14, 2012 19:49
-
-
Save ivliaspiration/2387463 to your computer and use it in GitHub Desktop.
Rspec test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'logging in' do | |
it "lets the admin log in" do | |
visit login_path | |
page.should have_css("input#password") | |
fill_in "password", :with => "secret" | |
click_on "Log in" | |
page.should have_content("Sucessfully logged in") | |
end | |
it "doesn't allow logging in with the wrong password" do | |
visit login_path | |
fill_in "password", :with => "anything else" | |
click_on "Log in" | |
current_page.should eq(login_path) | |
page.should have_selector("input#password") | |
page.should have_content("Wrong password") | |
end | |
it "allows to log out" do | |
sign_in_as_admin | |
visit logout_path | |
page.should have_content("Sucessfully logged out") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment