[rspec-users] having trouble specing an ajax request

Ben Mabey ben at benmabey.com
Wed Mar 5 13:18:37 EST 2008


Namrata Tiwari wrote:
> Sorry I pasted the wrong spec.
> Here is correct one -
>
>   it "should show deals listing" do
>     controller.stub!(:prepare_search_conditions).and_return(true)
>     Deal.should_receive(:paginate).and_return(@deals)
>
>     get :index
>     controller.expect_render(:partial => '/deals/front/listing')
>   end
>
>   
>> Thanks,
>> Namrata.
>>     
>
>   
Try setting your headers before your get request.. Like so:

@request.env["HTTP_ACCEPT"] = "application/javascript"

-Ben



More information about the rspec-users mailing list