Skip to content

Instantly share code, notes, and snippets.

@JFickel
Created June 30, 2012 05:42
Show Gist options
  • Save JFickel/3022485 to your computer and use it in GitHub Desktop.
Save JFickel/3022485 to your computer and use it in GitHub Desktop.
Failures:
1) User pages signup with valid information followed by signout
Failure/Error: before { click_link("Sign out") }
Capybara::ElementNotFound:
no link with title, id or text 'Sign out' found
# (eval):2:in `click_link'
# ./spec/requests/user_pages_spec.rb:55:in `block (5 levels) in <top (required)>'
Finished in 0.78348 seconds
43 examples, 1 failure
require 'spec_helper'
describe "User pages" do
subject { page }
describe "signup page" do
before { visit signup_path }
it { should have_selector('h1', text: 'Sign up') }
it { should have_selector('title', text: 'Sign up') }
end
describe "profile page" do
let(:user) { FactoryGirl.create(:user) }
before { visit user_path(user) }
it { should have_selector('h1', text: user.name) }
it { should have_selector('title', text: user.name) }
end
describe "signup" do
before { visit signup_path }
let(:submit) { "Create my account" }
describe "with invalid information" do
it "should not create a user" do
expect { click_button submit }.not_to change(User, :count)
end
end
describe "with valid information" do
before do
fill_in "Name", with: "Example User"
fill_in "Email", with: "[email protected]"
fill_in "Password", with: "foobar"
fill_in "Confirmation", with: "foobar"
end
describe "after saving the user" do
before {click_button submit}
let(:user) {User.find_by_email('[email protected]')}
it {should have_selector('title', text: user.name)}
it {should have_selector('div.alert.alert-success', text: 'Welcome')}
it {should have_link('Sign out')}
end
it "should create a user" do
expect { click_button submit }.to change(User, :count).by(1)
end
describe "followed by signout" do
before { click_link "Sign out" }
it { should have_link('Sign in') }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment