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

Mr Jaba the.jaba at gmail.com
Tue Jul 27 07:25:31 PDT 2010


So it should look something like:

http://gist.github.com/492284

On 27 July 2010 15:22, Riccardo Tacconi <rtacconi at gmail.com> wrote:

> I already tried that and I get
>
> NoMethodError: undefined method `body' for nil:NilClass
>
> Two days trying to solve this :-(
>
>
> On 27 July 2010 14:58, Mr Jaba <the.jaba at gmail.com> wrote:
>
>> Tim has hit the nail on the head there, there will be no response.body
>> either @response or app.response until you have made the request (the delete
>> line).
>> Move the put down after the delete and try again.
>>
>>
>>
>> On 27 July 2010 14:56, Tim Cowlishaw <tim at timcowlishaw.co.uk> wrote:
>>
>>>
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> Chat mailing list
>>> Chat at lists.lrug.org
>>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>
>>>
>>
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
>>
>
>
> --
> Riccardo Tacconi
> Web developer at Wolseley UK
>
> http://www.linkedin.com/in/riccardotacconi
> http://riccardotacconi.blogspot.com/
> http://twitter.com/rtacconi
> Linux user: #400461
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20100727/b898c42d/attachment-0003.html>


More information about the Chat mailing list