Here is the action -
def list
    @articles = find_city.articles.paginate :all,  :page => 
params[:page] , :order     => "live_on DESC", :conditions => { :type_for 
=> "blog" }
end

and the spec -

it "should list all articles 2" do
    articles = mock("articles")
    get :list

    controller.should_receive(:find_city).and_return(articles)
    controller.should_receive(:articles)

    articles.should_receive(:paginate).with(:order => "live_on DESC", 
:conditions => { :type_for => "blog" })
    response.should render_template('articles/list')
end


I am stubbing find_city and articles during set up

before_post do
   controller.stub!(:find_city)
   controller.stub!(:articles)
end

Is this right?
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to