[rspec-users] rspec controller action list

Bryan Ray bryansray at gmail.com
Fri Feb 29 08:52:10 EST 2008

It has to do with your "find_city" method. You spec is expecting it to be
called from controller, hence:


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.

Hope that helps, buddy.

On Thu, Feb 28, 2008 at 10:27 PM, Namrata Tiwari <lists at ruby-forum.com>

> Thanks Mr David for your reply. This gives me a better understanding of
> so called train wreck. I am still facing problems with this spec.
> firstly - I think I need to put a colon before order(e.g. :order=>
> "live_on DESC")
> #list
>   it "should list all articles" do
>     articles = mock("articles")
>    articles.should_receive(:paginate).with(:order => "live_on DESC",
> :conditions => { :type_for => "blog" })
>    controller.should_receive(:find_city).and_return(articles)
>    get :list
>   end
> but this gives me the following error
> Spec::Mocks::MockExpectationError in 'ArticlesController should list all
> article
> s'
> Mock 'ArticlesController' expected :find_city with (any args) once, but
> received
>  it 0 times
> spec/controllers/articles_controller_spec.rb:3:
> Thanks,
> Namrata.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Bryan Ray

"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."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080229/f5d7e2b9/attachment.html 

More information about the rspec-users mailing list