[rspec-devel] If you set an expectation on something that's already stubbed, should it return the stubbed value?

Pat Maddox pergesu at gmail.com
Wed Sep 17 11:49:56 EDT 2008


On Tue, Sep 16, 2008 at 10:14 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Tue, Sep 16, 2008 at 8:23 PM, Pat Maddox <pergesu at gmail.com> wrote:
>>> Hey Pat - looks like message expectations that inherit (for lack of a
>>> better term) the return value from a previously defined stub ignore
>>> the block, expected_from, and any subsequent arguments passed to the
>>> message expectation. Can you add examples for those and make sure they
>>> pass before committing this. I added one for blocks (which fails) to
>>> get you started - patch attached.
>>
>> Took care of the blocks and expected_from... I'm not sure what you
>> mean by "any subsequent arguments passed to the message expectation
>> though" ?  My best guess is that you're talking about the options
>> hash...
>>
>> To tell you the truth, I've never used it before :)  I figured the
>> best way to test this was to look at the options_hash_spec (since that
>> seems like the only place where it's really used?).  But what I found
>> is that those examples seem to be broken...I changed the spec around
>> to make it clearly fail, but it still passed.  I've attached a patch
>> that shows it (apply it with "git apply").  Do you have any idea
>> what's going on?
>
> Yeah - those code examples sucked. They are now greatly improved (and
> unable to reproduce the false positives you saw):
>
> http://github.com/dchelimsky/rspec/commit/5043400

Okay, so I think http://github.com/pat-maddox/rspec/commit/fab5ddf62
ought to finish it all off.  How's it look to you?

Pat


More information about the rspec-devel mailing list