It has to do with your &quot;find_city&quot; method. You spec is expecting it to be called from controller, hence:<br><br>controller.should_receive(:find_city)<br><br>Where is that method and why isn&#39;t it being called should be your next questions based on the code and spec you&#39;ve pasted.<br>
<br>Hope that helps, buddy.<br><br><div class="gmail_quote">On Thu, Feb 28, 2008 at 10:27 PM, Namrata Tiwari &lt;<a href="mailto:lists@ruby-forum.com">lists@ruby-forum.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;">
Thanks Mr David for your reply. This gives me a better understanding of<br>
so called train wreck. I am still facing problems with this spec.<br>
firstly - I think I need to put a colon before order(e.g. :order=&gt;<br>
&quot;live_on DESC&quot;)<br>
<br>
#list<br>
<div class="Ih2E3d"> &nbsp;it &quot;should list all articles&quot; do<br>
</div><div class="Ih2E3d"> &nbsp; &nbsp;articles = mock(&quot;articles&quot;)<br>
 &nbsp; &nbsp;articles.should_receive(:paginate).with(:order =&gt; &quot;live_on DESC&quot;,<br>
:conditions =&gt; { :type_for =&gt; &quot;blog&quot; })<br>
 &nbsp; &nbsp;controller.should_receive(:find_city).and_return(articles)<br>
 &nbsp; &nbsp;get :list<br>
</div> &nbsp;end<br>
<br>
<br>
but this gives me the following error<br>
Spec::Mocks::MockExpectationError in &#39;ArticlesController should list all<br>
article<br>
s&#39;<br>
Mock &#39;ArticlesController&#39; expected :find_city with (any args) once, but<br>
received<br>
&nbsp;it 0 times<br>
<div class="Ih2E3d">spec/controllers/articles_controller_spec.rb:3:<br>
<br>
</div>Thanks,<br>
Namrata.<br>
<font color="#888888">--<br>
</font><div><div></div><div class="Wj3C7c">Posted via <a href="http://www.ruby-forum.com/" target="_blank">http://www.ruby-forum.com/</a>.<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Bryan Ray<br><a href="http://www.bryanray.net">http://www.bryanray.net</a><br><br>&quot;Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.&quot;