Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
sample_app_ch9/spec/requests/user_pages_spec.rb
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
48 lines (36 sloc)
1.08 KB
This file contains 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 "User pages" do | |
subject { page } | |
describe "profile page" do | |
let(:user) { FactoryGirl.create(:user) } | |
before { visit user_path(user) } | |
it { should have_content(user.name) } | |
it { should have_title(user.name) } | |
end | |
describe "signup page" do | |
before { visit signup_path } | |
it { should have_content('Sign up') } | |
it { should have_title(full_title('Sign up')) } | |
end | |
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: "user@example.com" | |
fill_in "Password", with: "foobar" | |
fill_in "Confirmation", with: "foobar" | |
end | |
it "should create a user" do | |
expect { click_button submit }.to change(User, :count).by(1) | |
end | |
end | |
end | |
end |