On Thu, Sep 25, 2008 at 1:04 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote:
> On 2008-09-25, at 13:58, Tero Tilus wrote:
>>
>> 2008-09-25 13:47, Nick Hoffman:
>>>
>>> I'm calling #stub! and #should_receive on the same method within a
>>> class, and am finding that the method doesn't return the value given
>>> to #stub!
>>
>> How about GMarker.should_receive(:new).with(foo).and_return mock_marker
>
> I knew there was a dead simple answer to the question. Thanks, Tero.

That should work too, but recent changes support returning a
previously defined stub value when you don't specify a return value in
a mock expectation:

  foo = mock('foo')
  foo.stub!(:bar).and_return('stub value')
  foo.should_receive(:bar).with('anything')
  foo.bar('anything')
  => 'stub value'


> Apologies for the brain fart.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to