I've been using rspec for a few years now and one thing has bothered me since the switch to the new *expect* syntax. For partial mocks, when using allow/expect(something).to receive... it reads more like a spy to me than a stub. Using an example from the README:
expect(Person).to receive(:find) Reading this like a sentence, I would expect *Person* to receive a call to *find*...and that's it. Nothing in the above indicates to me that the *find* method should also be stubbed. The stub behavior seems like a side effect. My proposal would be to change the default behavior of *receive* so that *and_call_original* is the default behavior. An additional method could be added to to trigger the stub behavior. So the equivalent behavior for the above example would read something like this: expect(Person).to receive(:find).and_stub Obviously making this change would be relatively painful in that: * some may not agree that this is the correct behavior * those that are used to the prior behavior would have to get used to the new behavior * it would break a lot of existing tests Given the above I wanted to post here to see how others felt before submitting a pull request. My apologies if this has already been discussed, I did a search of the issues in the rspec-mocks repository and this forum and I couldn't find anything. -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/8d5d5525-5749-4284-b8d7-e38833758d13%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
