This action will list all the articles according to city. Please, can
some one guide me through this spec.
def list
@articles = find_city.articles.paginate :all, :page => params[:page]
, :order
=> “live_on DESC”, :conditions => { :type_for => “blog” }
end
it “should list all articles” do
get :list
controller.stub!(:find_city)
controller.should_receive(:find_city)
controller.stub!(:articles)
controller.should_receive(:articles)
articles.should_receive(:paginate).and_return(@articles)
response.should render_template('articles/list')
end
I get the following error when I run the spec.
NameError in ‘ArticlesController should list all articles’
undefined local variable or method `articles’ for
#<Spec::Rails::Example::Contro
llerExampleGroup::Subclass_1:0xa7b57dc>
spec/controllers/articles_controller_spec.rb:212:
spec/controllers/articles_controller_spec.rb:3: