2007/12/29, Andrew WC Brown <[EMAIL PROTECTED]>:

> I just see these large blocks of:
>
> @shopping_list.should_receive(:milk)..and_return('milk')
>  @shopping_list.should_receive(:bagel).and_return('bagel')
> @shopping_list.should_receive(:coffee).and_return('coffee')
>
> and it would be much clearer if I could list them in a hash instead.

What about :

{
  :milk => 'milk',
  :bagel => 'bagel',
  :coffee => 'coffee'
}.each do |method, value|
  @shopping_list.should_receive(method).and_return(value)
end

So it doesn't need a #should_receive_the_following method.

   -- Jean-François.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to