Hi all (I replied off-list and Riccardo replied directly to me, but I believe Riccardo's intention was to email the whole list, so I am forwarding).<div><br></div><div>Riccardo, are you using Rails 2.3.6, .7, or .8? Try it with 2.3.5. (I've stayed on 2.3.5 because I saw redirects not happening correctly in the newer versions).</div>
<div><br></div><div>Matt</div><div><br><br><div class="gmail_quote">On Tue, Jul 27, 2010 at 11:49 AM, Riccardo Tacconi <span dir="ltr"><<a href="mailto:rtacconi@gmail.com">rtacconi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thanks to all,<br><br>I cleaned the code and used @response and I get the out put:<br><br><html><body>You are being <a href="<a href="http://test.host/configurations/25/edit" target="_blank">http://test.host/configurations/25/edit</a>">redirected</a>.</body></html><br>
<br>So the response is 200 insted of redirecting to <a href="http://test.host/configurations/25/edit" target="_blank">http://test.host/configurations/25/edit</a> with a 302 status. The strange thing is that without Shoulda I get a 302. <br>
<div><div></div><div class="h5">
<br><div class="gmail_quote">On 27 July 2010 16:36, Matthew Krom <span dir="ltr"><<a href="mailto:matthew.krom@gmail.com" target="_blank">matthew.krom@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div bgcolor="#FFFFFF"><div>Try response instead of @response (no @ )</div><div><br></div><div>(off list, because I have not taken the time to read the whole thread)<br><font color="#888888"><br>Matthew Krom, principal<div>
MW Krom LLC</div><div>Cambridge, MA</div><div>+1 617 852 5130</div></font></div><div><div></div><div><div><br>On Jul 27, 2010, at 11:33 AM, Riccardo Tacconi <<a href="mailto:rtacconi@gmail.com" target="_blank">rtacconi@gmail.com</a>> wrote:<br>
<br></div><div></div><blockquote type="cite"><div>Yes,<br><br>That is the order I use. But @response is still nil. I implemented the same test inside a standard Unit::Test and it worked without any error.<br><br><div class="gmail_quote">
On 27 July 2010 15:25, Mr Jaba <span dir="ltr"><<a href="mailto:the.jaba@gmail.com" target="_blank"></a><a href="mailto:the.jaba@gmail.com" target="_blank">the.jaba@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">So it should look something like:<br><br><a href="http://gist.github.com/492284" target="_blank"></a><a href="http://gist.github.com/492284" target="_blank">http://gist.github.com/492284</a><div>
<div></div><div><br><br><div class="gmail_quote">On 27 July 2010 15:22, Riccardo Tacconi <span dir="ltr"><<a href="mailto:rtacconi@gmail.com" target="_blank"></a><a href="mailto:rtacconi@gmail.com" target="_blank">rtacconi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">I already tried that and I get<br><br>NoMethodError: undefined method `body' for nil:NilClass<br>
<br>Two days trying to solve this :-(<div><div></div><div><br><br><div class="gmail_quote">On 27 July 2010 14:58, Mr Jaba <span dir="ltr"><<a href="mailto:the.jaba@gmail.com" target="_blank"></a><a href="mailto:the.jaba@gmail.com" target="_blank">the.jaba@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">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).<br>
Move the put down after the delete and try again. <br><br><br><br>
<div class="gmail_quote"><div><div></div><div>On 27 July 2010 14:56, Tim Cowlishaw <span dir="ltr"><<a href="mailto:tim@timcowlishaw.co.uk" target="_blank"></a><a href="mailto:tim@timcowlishaw.co.uk" target="_blank">tim@timcowlishaw.co.uk</a>></span> wrote:<br>
</div>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div>
<div style="word-wrap:break-word"><br><div><div><div>On 27 Jul 2010, at 14:43, Riccardo Tacconi wrote:</div><br></div><blockquote type="cite"><div class="gmail_quote"><div>On 27 July 2010 13:21, Murray Steele <span dir="ltr"><<a href="mailto:murray.steele@gmail.com" target="_blank"></a><a href="mailto:murray.steele@gmail.com" target="_blank">murray.steele@gmail.com</a>></span> wrote:</div>
<div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div class="gmail_quote"><div><div><div> should "delete :destroy participations" do<br>
</div>
app = ApplicationController.new</div><div><div> puts app.response.body</div><div> assert_difference('Participation.count', -1) do<br> delete :destroy, :id => @p.to_param<br> end<br>
end<br><br></div></div></div></div></blockquote><div><br><b>Ok, but it does not print anything</b><br> </div></div></div></blockquote><br></div><div>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: <a href="http://guides.rubyonrails.org/testing.html#functional-tests-for-your-controllers" target="_blank"></a><a href="http://guides.rubyonrails.org/testing.html#functional-tests-for-your-controllers" target="_blank">http://guides.rubyonrails.org/testing.html#functional-tests-for-your-controllers</a>, 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.</div>
<div><br></div><div>Cheers,</div><div><br></div><font color="#888888"><div>Tim</div><div><br></div><div><br></div></font></div><br></div></div><div>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank"></a><a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank"></a><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></div></blockquote></div><br>
<br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank"></a><a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank"></a><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br><br clear="all"><br></div></div><div><div></div><div>-- <br>Riccardo Tacconi<br>Web developer at Wolseley UK <br><br><a href="http://www.linkedin.com/in/riccardotacconi" target="_blank"></a><a href="http://www.linkedin.com/in/riccardotacconi" target="_blank">http://www.linkedin.com/in/riccardotacconi</a><br>
<a href="http://riccardotacconi.blogspot.com/" target="_blank"></a><a href="http://riccardotacconi.blogspot.com/" target="_blank">http://riccardotacconi.blogspot.com/</a><br>
<a href="http://twitter.com/rtacconi" target="_blank"></a><a href="http://twitter.com/rtacconi" target="_blank">http://twitter.com/rtacconi</a><br>Linux user: #400461<br>
</div></div><br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank"></a><a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank"></a><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank"></a><a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank"></a><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Riccardo Tacconi<br>Web developer at Wolseley UK <br><br><a href="http://www.linkedin.com/in/riccardotacconi" target="_blank"></a><a href="http://www.linkedin.com/in/riccardotacconi" target="_blank">http://www.linkedin.com/in/riccardotacconi</a><br>
<a href="http://riccardotacconi.blogspot.com/" target="_blank"></a><a href="http://riccardotacconi.blogspot.com/" target="_blank">http://riccardotacconi.blogspot.com/</a><br>
<a href="http://twitter.com/rtacconi" target="_blank"></a><a href="http://twitter.com/rtacconi" target="_blank">http://twitter.com/rtacconi</a><br>Linux user: #400461<br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Chat mailing list</span><br><span><a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a></span><br>
<span><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a></span><br></div></blockquote></div></div></div></blockquote></div><br><br clear="all">
<br>
-- <br>Riccardo Tacconi<br>Web developer at Wolseley UK <br><br><a href="http://www.linkedin.com/in/riccardotacconi" target="_blank">http://www.linkedin.com/in/riccardotacconi</a><br><a href="http://riccardotacconi.blogspot.com/" target="_blank">http://riccardotacconi.blogspot.com/</a><br>
<a href="http://twitter.com/rtacconi" target="_blank">http://twitter.com/rtacconi</a><br>Linux user: #400461<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="mailto:matthew.krom@gmail.com">matthew.krom@gmail.com</a><br>MW Krom LLC<br>Cambridge, MA<br>617 852 5130<br>
</div>