eg.<br>I&#39;m going to the store to buy one milk<br>I&#39;m going to the store to buy one bagel<br>I&#39;m going to the store to buy one coffee<br><br>@shopping_list.should_receive(:milk).once.and_return(&#39;milk&#39;)<br>
@shopping_list.should_receive(:bagel).once.and_return(&#39;bagel&#39;)<br>@shopping_list.should_receive(:coffee).once.and_return(&#39;coffee&#39;)<br><br>I going to the store to buy one:<br>&nbsp;* milk<br>&nbsp;* bagel<br>&nbsp;* coffee
<br><br>@shopping_list.should_receive_the_following(<br>
&nbsp; :milk =&gt; &#39;milk&#39;<br>

&nbsp; :bagel =&gt; &#39;bagel&#39;<br>

&nbsp; :coffee =&gt; &#39;coffee&#39;<br>).once<br><br>For the shopping list I describe its expected that they all have the same expectations.<br>I&#39;m still reading the rspec source.<br><br>I would think of creating a new method called: should_receive_the_following but seeing how the message_expectations work not sure how plausible it would be to implement.
<br><br>You wouldn&#39;t expect to return something:<br><br>
@shopping_list.should_receive_the_following(<br>
&nbsp; :milk =&gt; &#39;milk&#39;<br>
&nbsp; :bagel =&gt; &#39;bagel&#39;<br>
&nbsp; :coffee =&gt; &#39;coffee&#39;<br>
).once.and_return(@list)<br><br>It boggles my mind. I haven&#39;t done too much meta programming.<br><br>I just see these large blocks of:<br><br>@shopping_list.should_receive(:milk)..and_return(&#39;milk&#39;)<br>
@shopping_list.should_receive(:bagel).and_return(&#39;bagel&#39;)<br>
@shopping_list.should_receive(:coffee).and_return(&#39;coffee&#39;)<br><br>and it would be much clearer if I could list them in a hash instead.<br><br><br><div class="gmail_quote">On Dec 29, 2007 1:29 PM, Pat Maddox &lt;
<a href="mailto:pergesu@gmail.com">pergesu@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Dec 28, 2007 11:00 PM, Andrew WC Brown &lt;
<a href="mailto:omen.king@gmail.com">omen.king@gmail.com</a>&gt; wrote:<br>&gt; I was looking over some of my specs.<br>&gt; I was thinking that the following:<br>&gt;<br>&gt; @game.should_receive(:name).and_return(&#39;The Battle for Blaze&#39;)
<br>&gt; @game.should_receive(:people).and_return(5000000)<br>&gt; @game.should_receive (:activated).and_return(true)<br>&gt;<br>&gt; Would it look cleaner if I could do this instead?<br>&gt;<br>&gt; @game.should_recieve_and_return
(<br>&gt; &nbsp; :name =&gt; &#39;The Battle for Blaze&#39;<br>&gt; &nbsp; :people =&gt; 5000000<br>&gt; &nbsp; :activated =&gt; true)<br>&gt;<br>&gt; Opinions?<br>&gt;<br>&gt; _______________________________________________<br>&gt; rspec-users mailing list
<br>&gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>&gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
&gt;<br><br>Two thoughts as to why I wouldn&#39;t use this...<br><br>1. One expectation per example<br>2. Stub queries, expect commands<br><br>Your way is clean though. &nbsp;How do you handle arguments?<br><br>Pat<br>_______________________________________________
<br>rspec-users mailing list<br><a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users
</a><br></blockquote></div><br>