Displaying 2 results from an estimated 2 matches for "second_valu".
Did you mean:
second_value
2008 Jun 05
1
Using and_yield to pass multiple or no iterations
...ch_row ).and_yield( :value )
@egg.do_thing.should be_true
end
</SPEC>
Secondly, is this the best (correct) way to pass multiple values to
iterate over?
<SPEC>
it "should be doing something else, too"
@egg.stub!( :each_row ).
and_yield( :first_value ).
and_yield( :second_value ).
and_yield( :third_value )
@egg.do_thing.should be_true
end
</SPEC>
As you can see, my understanding of and_yield() is *very* imperfect, so
any & all pointers are very gratefully received.
Cheers,
Doug.
--
Posted via http://www.ruby-forum.com/.
2007 Mar 03
11
Beyond multiple return values
First off, I love mocha and have been using it all over the place
ever since I found it a few months ago.
So I noticed the other day rather belatedly that mocha-0.4.0 had been
released and that we can now do the object.stubs(:method).returns
(:first_value, :second_value). Much neater than fiddling with lambdas
everytime this sort of behaviour is needed
But can we go further ? I was writing a test today and I wanted the
first call to a method to raise an exception and the next call to
return a value (I was testing a method on an ActiveRecord object
where...