-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mocking a method exactly should not prevent the method from being called with other arguments #11
Comments
It looks like there are multiple calls to render. Try: |
The output I get is then:
|
I can confirm this behavior in rr 0.10.11, rails 2.3.5, rspec 1.3 There is def, as you suggested, a double call to render. This is expected - first the parent view starts rendering, then the child (or partial) view renders. 2 calls to template.render Rspec mocks can handle this scenario just fine (as noted by OP). Even more confusing is the fact that most examples in the readme deal with the 'doubling' of render(:partial) yet I can't get this to work in view specs at all. Thoughts on how we can set rr up to do this? Any work around? I've tried numerous combinations/setups with no luck. Regardless thanks for the cool framework. I'm really hoping to switch to this syntax. It's so nice. |
I dove into the source and found a solution to this. You can write the test as follows:
I was hoping to be able to use spies (since they seem more appropriate here) but there is a catch the following passes ok but when it's intentionally broken rspec hangs.
I'll open a new issue to get to the bottom of that one. |
I'll go ahead and mark this as a feature. If you mock a method exactly then it should not prevent the method from being called with other arguments. |
Using rails 2.3.3 and rspec 1.2.6, my view is simply this:
My rspec test looks like this:
Which results in:
Any advice?
The text was updated successfully, but these errors were encountered: