If I understand correctly, you could do something like this -
http://pastie.caboo.se/11570.
I''m planning to wrap this up into a convenience method like the
on_consecutive_calls stuff in JMock.
--
James.
http://blog.floehopper.org
On 03/09/06, Kevin Clark <kevin.clark at gmail.com>
wrote:> Right now I''m working on adding tests to a method that looks like
this:
>
> def get_via_redirect(path, args={})
> get path, args
> follow_redirect! while redirect?
> status
> end
>
> So, I want to confirm that get is called and that status is returned
> but I also want to see that when the value of redirect? effects how
> many times follow_redirect is called. Is there already a built in way
> to do this or should I go hacking?
>
> My test looks a bit like this at the moment:
>
> # This needs redirect? to change what it returns...
> # def test_get_via_redirect
> # path = "/somepath"
> # args = {:id => ''1''}
> # @session.expects(:get).with(path,args)
> # @session.stubs(:redirect?).returns() <-- returns different values
> # @session.expects(:follow_redirect!). <-- expects it a certain
> amount of times
> # @session.get_via_redirect(pth, args)
> # end
>
>
> --
> Kevin Clark
> http://glu.ttono.us
> _______________________________________________
> mocha-developer mailing list
> mocha-developer at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mocha-developer
>