I'm trying to test some code that has validates each and I've got a very strange failure
Mock 'Book_1027' expected :store_with_privacy? with (#<Clip:0x1a99b96 @name="Clip_1025">) but received it with (#<Clip:0x1a99b96 @name="Clip_1025">) The Spec it "should check that a book can save a clip" do @user = mock_model( User, :id => 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.clip ) model.errors.add( :clip, "You can't add this item to this book" ) end end end ... end Any thoughts on what might be causing that? Cheers Daniel
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users