Do I need to spec an AR. If yes, what is the best way to spec this.
here is the code -

def index
   @deals   = Deal.paginate(:all, :conditions =>
prepare_search_conditions, :order
                           => 'created_at DESC',  :page => params[:page]
)
   if request.xhr?
     render :update do |page|
     page.replace_html "table", :partial => "/deals/front/listing"
   end
end

I am new to Rspec. Is this the right way?

it "should list all deals" do
    controller.stub!(:prepare_search_conditions).and_return(true)
    Deal.should_receive(:paginate).with(:all, {:conditions=>true,
                        :order=>"created_at DESC",
:page=>nil}).and_return(@deals)
    get :list
    controller.expect_render(:partial => '/deals/cms/list')
end

Thanks,
Namrata.
-- 
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