Skip to content

Instantly share code, notes, and snippets.

@ivliaspiration
Created April 14, 2012 19:49
Show Gist options
  • Save ivliaspiration/2387463 to your computer and use it in GitHub Desktop.
Save ivliaspiration/2387463 to your computer and use it in GitHub Desktop.
Rspec test
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