Sunday, 1 September 2013

Ruby Mocha - how to specify ".with" multiple ".times"

Ruby Mocha - how to specify ".with" multiple ".times"

I would like to be able to chain multiple .with expectations together. At
present I am putting them on separate lines -
foo.expects( :bar ).with( a )
foo.expects( :bar ).with( b )
foo.expects( :bar ).with( c )
With .returns you can just do -
foo.expects( :bar ).returns( a, b, c )
I would ideally like to be able to -
foo.expects( :bar ).returns( a, b, c ).with( a, b, c )
or
foo.expects( :bar ).returns( a, b, c ).with( a ).with( b ).with( c )

No comments:

Post a Comment