[mocha-developer] Expecting calls with two different parameters

Kevin Clark kevin.clark at gmail.com
Fri Oct 6 23:13:03 EDT 2006


Someone correct me if I'm wrong, but I thought you could set multiple
expectations on an object.

On 10/6/06, Bryan Helmkamp <bhelmkamp at gmail.com> wrote:
> Hello,
>
> I've just started using Mocha in the tests for my Rails app,  and I've
> run across an issue with mocking a method that should be called with
> different parameters.
>
> How would I setup a mock that expects that a method will be called
> once with no paramaters, and a second time with a parameter?  I'd be
> tempted to shortcut and just do something like
> foo.expects(:bar).times(2), but the value used as the parameter when
> calling it the second time is very important.
>
> Thoughts?
>
> -Bryan
>
> --
> http://www.MyCongress.org/ -- coming soon
> _______________________________________________
> mocha-developer mailing list
> mocha-developer at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mocha-developer
>


-- 
Kevin Clark
http://glu.ttono.us


More information about the mocha-developer mailing list