[rspec-users] Mock "Consent_6335" received unexpected message :marked_for_destruction? with (no args)

thoen thoen at edgevaleinteractive.com
Wed Mar 24 14:39:29 EDT 2010


I have a mock object (Person) that is associated with another object
(my_object) through a belongs_to association. When I check whether
my_object is valid (my_object.should be_valid), I am getting an error
like the following:

Mock "Person_6338" received unexpected
message :marked_for_destruction? with (no args)

Checking the list of methods on the mock, "marked_for_destruction?" is
not listed. Is this this something that i should expect to always
stub?

As a check, I added

          def  @target.marked_for_destruction?
            false
          end

to the mock_model definition and the test passed.

Rails 2.3.5
rspec (1.3.0, 1.2.6, 1.1.3)
rspec-rails (1.3.2, 1.2.6)


More information about the rspec-users mailing list