Sha256: b6497c11c140164d3cb0e4cfd7d31176ff6490d1268b5b506be80fb659e7fb1f
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Tagging do it { should belong_to(:post) } it { should belong_to(:tag) } it { should belong_to(:post, :tag) } it { should validate_associated(:post) } it { should validate_associated(:tag) } it { should validate_associated(:tag, :post) } it do # Create a Post mock that will return true when saving. # This means that the object Post is always valid, then it can not be validated. @post = mock_model(Post, :save => true, :valid? => true) should_not validate_associated(:post) end it do # Create a Tagging mock that will return true when saving. # This means that even the association :post is not valid, :tagging will be valid. # Then the association is not validated. @tagging = Tagging.new @tagging.stub!(:save).and_return(true) should_not validate_associated(:post) end end describe Tagging do should_belong_to :post should_belong_to :tag should_belong_to :post, :tag should_validate_associated :tag should_validate_associated :post should_validate_associated :tag, :post end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carlosbrando-remarkable-2.2.1 | spec/models/tagging_spec.rb |