[rspec-users] How to stub forever?

David Chelimsky dchelimsky at gmail.com
Fri Jul 11 05:40:54 EDT 2008


On 7/11/08, Piotr Wlodarek <lists at ruby-forum.com> wrote:
>
>  How to stub a method for multiple calls?
>
>  The calls are done in a loop.
>
>  I expect:
>  @agent.stub!( :submit ).multiple_times.and_return( @account_details_page
>  )
>  ..to stub submit method "forever" (any number of calls).

Stubs will do this automatically. Just do this:

@agent.stub!( :submit ).and_return(@account_details_page)

Cheers,
David


>
> --
>  Posted via http://www.ruby-forum.com/.
>  _______________________________________________
>  rspec-users mailing list
>  rspec-users at rubyforge.org
>  http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list