On Fri, Oct 17, 2008 at 3:37 PM, Stephen Eley <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 17, 2008 at 2:55 PM, Mark Thomson <[EMAIL PROTECTED]> wrote:
>>
>> and then check that the expected messages are being received -
>> file.should_receive(:puts).with("a string").once
>> file.should_receive(:puts).with("another string").once
>>
>> Here's what I'm puzzled about. If I don't include the expectation for the
>> first string in the spec, the spec will fail the expectation for the second
>> string. It seems as if "should_receive" is queuing up the messages that come
>> into the file object and when it tests an expectation it just looks at the
>> next one in line. If it doesn't match then the expectation will fail.
>
> That sounds right to me.  You declared 'file' as a mock.  Mocks are
> bratty little children that treat it as an error and throw a tantrum
> if you don't give them everything they expect, no more nor less.

Are you a proud parent? :)

-- 
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to