[rspec-devel] [ rspec-Bugs-13370 ] Weird mock expectation error

noreply at rubyforge.org noreply at rubyforge.org
Sat Aug 25 15:05:57 EDT 2007


Bugs item #13370, was opened at 2007-08-25 19:01
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13370&group_id=797

Category: mock module
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Yurii Rashkovskii (yrashk)
Assigned to: Nobody (None)
Summary: Weird mock expectation error

Initial Comment:
While running code that contains

@user.should_receive(:assigned_to?).with(@issue).any_number_of_times.and_return true

# @issue is a mock as well

I'm getting weird failure:

Mock 'User_1263' expected :assigned_to? with (#<Issue:0x18b79b8 @name="Issue_1261">) but received it with (#<Issue:0x18b79b8 @name="Issue_1261">)

Any ideas?

P.S. trunk rspec

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-25 19:05

Message:
This has come up recently. If @issue is a mock, then make sure that the object it is being compared to is not a rails AssociationProxy, which will tell you that it is the model object even though it is not.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13370&group_id=797


More information about the rspec-devel mailing list