This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Description
Mocha example:
@obj.stubs(:method).returns(1).then.raises
I propose a feature:
@obj.stub(:method).and_return(1).and_return(2).and_raise
When there are multiple and_* calls on the mock, they are called one after another. The last one is called indefinitely.
I'm sorry if something like that is already implemented. I wasn't able to find anything about that in the docs or Google. I merely found this gist... which is ugly compared to mocha approach. https://gist.github.com/dlchet/1847708
Foo.stub(:bar) do
@counter += 1
pp @counter
raise Exception if @counter < 2
"hello"
end