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/models/micropost_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.
21 lines (15 sloc)
479 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 do | |
let(:user) { FactoryGirl.create(:user) } | |
before { @micropost = user.microposts.build(content: "Lorem ipsum") } | |
subject { @micropost } | |
it { should respond_to(:content) } | |
it { should respond_to(:user_id) } | |
it { should respond_to(:user) } | |
its(:user) { should eq user } | |
it { should be_valid } | |
describe "when user_id is not present" do | |
before { @micropost.user_id = nil } | |
it { should_not be_valid } | |
end | |
end |