[rspec-users] Using and_yield to pass multiple or no iterations

John D. Hume duelin.markers at gmail.com
Thu Jun 5 12:30:27 EDT 2008

On Thu, Jun 5, 2008 at 5:46 AM, Doug Livesey <lists at ruby-forum.com> wrote:
> I have two questions with it. The first is, would it be possible to set
> it up to test the case when each_row operates on an empty Array?

If there were no rows, each_row wouldn't yield at all, so you should
just be able to do
  @o.stub! :each_row
(with no and_yield). Note that Ruby is happy to let you associate a
block with any method call, whether it's expected or not.

More information about the rspec-users mailing list