[Rspec-users] and_return broken when using arrays
dchelimsky at gmail.com
Fri Oct 27 19:01:02 EDT 2006
On 10/27/06, Micah Martin <micah at 8thlight.com> wrote:
> m = mock("blah")
> m.should_receive(:foo).and_return([1, 2, 3])
> When foo() is called on the mock it returns the first elements of the array,
> 1. Shouldn't it return the whole array?
Yes it should. And it does in 0.7.
The "feature" that you are experiencing was an early attempt to
support consecutive return values. For 0.6, if you want it to return
an Array you have to wrap it in an array:
m.should_receive(:foo).and_return([[1, 2, 3]])
0.7 is coming up very soon though!
> Micah Martin
> 8th Light, Inc.
> Rspec-users mailing list
> Rspec-users at rubyforge.org
More information about the Rspec-users