It has to do with your "find_city" 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't it being called should be your next questions based on the code and spec you'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 <<a href="mailto:lists@ruby-forum.com">lists@ruby-forum.com</a>> 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=><br>
"live_on DESC")<br>
<br>
#list<br>
<div class="Ih2E3d"> it "should list all articles" do<br>
</div><div class="Ih2E3d"> articles = mock("articles")<br>
articles.should_receive(:paginate).with(:order => "live_on DESC",<br>
:conditions => { :type_for => "blog" })<br>
controller.should_receive(:find_city).and_return(articles)<br>
get :list<br>
</div> end<br>
<br>
<br>
but this gives me the following error<br>
Spec::Mocks::MockExpectationError in 'ArticlesController should list all<br>
article<br>
s'<br>
Mock 'ArticlesController' expected :find_city with (any args) once, but<br>
received<br>
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>"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."