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/micropost_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.
33 lines (24 sloc)
768 Bytes
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 "Micropost pages" do | |
subject { page } | |
let(:user) { FactoryGirl.create(:user) } | |
before { sign_in user } | |
describe "micropost creation" do | |
before { visit root_path } | |
describe "with invalid information" do | |
it "should not create a micropost" do | |
expect { click_button "Post" }.not_to change(Micropost, :count) | |
end | |
describe "error messages" do | |
before { click_button "Post" } | |
it { should have_content('error') } | |
end | |
end | |
describe "with valid information" do | |
before { fill_in 'micropost_content', with: "Lorem ipsum" } | |
it "should create a micropost" do | |
expect { click_button "Post" }.to change(Micropost, :count).by(1) | |
end | |
end | |
end | |
end |