Sha256: b3b85929092101984be3af692d4f9fc090215ae8a7f8b5c345c7087db5799c9f
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
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 == user } it { should be_valid } describe "accessible attributes" do it "should not allow access to user_id" do expect do Micropost.new(user_id: user.id) end.to raise_error(ActiveModel::MassAssignmentSecurity::Error) end end describe "when user_id is not present" do before { @micropost.user_id = nil } it { should_not be_valid } end #CHECK CONTENT describe "when user_id is not present" do before { @micropost.user_id = nil } it { should_not be_valid } end describe "with blank content" do before { @micropost.content = " " } it { should_not be_valid } end describe "with content that is too long" do before { @micropost.content = "a" * 141 } it { should_not be_valid } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guara-0.0.3 | spec/models/micropost_spec.rb |
guara-0.0.1.rc | spec/models/micropost_spec.rb |