[rspec-devel] [ rspec-Bugs-12547 ] validates_each issue in rails with mocking and stubbing
noreply at rubyforge.org
noreply at rubyforge.org
Tue Aug 21 20:51:01 EDT 2007
Bugs item #12547, was opened at 2007-07-24 17:17
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=12547&group_id=797
Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Daniel Neighman (hassox)
Assigned to: Nobody (None)
Summary: validates_each issue in rails with mocking and stubbing
Initial Comment:
I've been trying some code that checks for a validates_each call in an AR model.
The spec:
http://pastie.caboo.se/81744
This produces the following error:
does not detect that two responses are equal
Mock 'Book_1027' expected :store_with_privacy? with (#<Clip:0x1a9139c @name="Clip_1025">) but received it with (#<Clip:0x1a9139c @name="Clip_1025">)
and
stub overwrites mock
Mock 'Book_1026' expected :store_with_privacy? with (#<Clip:0x1a91b1c @name="Clip_1025">) once, but received it 0 times
The Model is:
http://pastie.caboo.se/81745
----------------------------------------------------------------------
Comment By: Michael Hamann (michitux)
Date: 2007-08-22 02:51
Message:
I just added an expectation in rspec_on_rails that shows the problem, here the diff: http://pastie.caboo.se/89880 - I hope that is enough and helps.
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-22 02:41
Message:
Daniel - I started to look at this, but due to the dependencies on other models couldn't really get anything going w/o making some assumptions.
If you would wrap up your project in a zip and either post it here or email me directly, I'll be glad to take a look at it. I just need to be able to unzip a file, create a db, run migrations and go.
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-22 02:28
Message:
Michael - would you mind posting your spec please? Maybe a pastie.
----------------------------------------------------------------------
Comment By: Michael Hamann (michitux)
Date: 2007-08-22 02:19
Message:
The problem that stub overwrites should_receive/expect occurs also in view-specs with template.stub_render and template.expect_render. Example: I have a partial that is rendered in a template. I test several things where I don't want to pay any attention to this partial. But then I want to test that the partial is actually rendered. Unfortunately this doesn't work. I am using rspec_on_rails revision 2419.
----------------------------------------------------------------------
Comment By: Daniel Neighman (hassox)
Date: 2007-07-24 17:38
Message:
The migrations are here
http://pastie.caboo.se/81756
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-07-24 17:29
Message:
Would you mind posting the relevant migrations as well? Then I can build a subset of your app and see the error happen.
----------------------------------------------------------------------
Comment By: Daniel Neighman (hassox)
Date: 2007-07-24 17:23
Message:
A bit more information
I have rspec installed as plugins in rails
rspec 2174
rspec_on_rails 2174
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=12547&group_id=797
More information about the rspec-devel
mailing list