[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 06:58:11 PDT 2010
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20100727/fd4f3935/attachment-0003.html>
More information about the Chat
mailing list