Skip to content

Instantly share code, notes, and snippets.

@keeperofthenecklace
Created August 18, 2012 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keeperofthenecklace/3388745 to your computer and use it in GitHub Desktop.
Save keeperofthenecklace/3388745 to your computer and use it in GitHub Desktop.
spec/requests/authentication_pages_spec.rb
require 'spec_helper'
describe "authentication" do
subject { page }
describe "signin page" do
before { visit signin_path }
describe "with invalid information" do
before { click_button "Sign in"}
it { should have_selector('h1', text: 'Sign in') }
it { should have_selector('title', text: 'Sign in') }
it { should have_selector('div.alert.alert-error', text: 'Invalid') }
describe "after visiting another page" do
before { click_link "Home" }
it { should_not have_selector('div.alert.alert-error')}
end
end
describe "with valid information" do
let(:user) { FactoryGirl.create(:user) }
#before do
#fill_in "Email", with: user.email
#fill_in "Password", with: user.password
#click_button "Sign in"
#end
before { sign_in user }
it { should have_selector('title', text: user.name) }
it { should have_link('Profile', href: user_path(user)) }
it { should have_link('Settings', href: edit_user_path(user)) }
it { should have_link('Sign out', href: signout_path) }
it { should_not have_link('Sign in', href: signin_path) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment