search for: valid_clipping_attribut

Displaying 2 results from an estimated 2 matches for "valid_clipping_attribut".

2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi, I''m a bit stuck with mocking a unit test of a join model with regards to a validates_uniqueness_of clause. I have class Book < AR:B has_many :clippings various validates_presence_of etc end class Clip < AR:B has_many :clippings various validates_presence_of etc end class Clipping < AR:B belongs_to :book belongs_to :clip validates_uniqueness_of :clip_id,
2007 Jul 24
4
Possible Bug
...3 ) @clip = mock_model( Clip, :id => 1, :privacy => :public, :user => @user ) @book = mock_model( Book, :id => 2, :privacy => :public, :user => @user, :user_id => @user.id ) @book.should_receive( :store_with_privacy? ).with( @clip ) clipping = Clipping.new( valid_clipping_attributes.with( :clip => @clip, :book => @book ) ) clipping.valid? end And the model class Clipping < AR:B belongs_to :clip belongs_to :book ... validates_each :clip do |model, attr, value| if !model.book.nil? && !model.clip.nil? if !model.book.store_with_privacy?( model...