[LRUG] Expected response to be a <:redirect>, but was <200> when using should_redirect_to

Tim Cowlishaw tim at timcowlishaw.co.uk
Tue Jul 27 06:56:07 PDT 2010


On 27 Jul 2010, at 14:43, Riccardo Tacconi wrote:

> On 27 July 2010 13:21, Murray Steele <murray.steele at gmail.com> wrote:
>     should "delete :destroy participations" do
>       app = ApplicationController.new
>       puts app.response.body
>       assert_difference('Participation.count', -1) do
>         delete :destroy, :id => @p.to_param
>       end
>     end
> 
> 
> Ok, but it does not print anything
>  

To caveat, I'm not massively familiar with either Test::Unit or Shoulda, but I can't quite see what this ApplicationController instance you're creating has to do with the request that your test is making. if you look in the testing guide: http://guides.rubyonrails.org/testing.html#functional-tests-for-your-controllers, you'll see that the request methods (like delete in your code) populate an instance variable called @response with the response of the request. try inspecting the body of this object in order to see what the response of your request was.

Cheers,

Tim


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20100727/c05d67b1/attachment-0003.html>


More information about the Chat mailing list