I''m getting pretty far with functional testing and have run into a situation where I''m checking a method that ''stamps'' db data into form fields on a PDF file. I have 6 such methods in my ''ClientsController'' and half the tests fail... def test_rhba_signoff_form login_with_administrator get :rhba_signoff_form, :id => 3 assert_response 302 end the failure is I get response 200 (which is a failure). test.log also clearly shows a 200 result. so I fired up ''webrick -p 7000 -e test'' and used a browser and was able to get these stamped PDF''s without a problem. (obviously not a 200) 3 of these same methods test without error but 3 methods test consistently with this error and there''s very little difference between them except the data fields so I made sure that when I tested against webrick, I used the same ''id => 3'' record and there''s no problem. I would really like to include this in my testing...is there some better/more reliable way to test for a response which isn''t a template response but rather a send_file "tmp/SOME.pdf", :type => "application/pdf", :disposition => ''inline'' That clearly delivers except in testing? Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 27 May 2008, at 00:02, Craig White wrote:> > the failure is I get response 200 (which is a failure). test.log also > clearly shows a 200 result. > > so I fired up ''webrick -p 7000 -e test'' and used a browser and was > able > to get these stamped PDF''s without a problem. (obviously not a 200) > > 3 of these same methods test without error but 3 methods test > consistently with this error and there''s very little difference > between > them except the data fields so I made sure that when I tested against > webrick, I used the same ''id => 3'' record and there''s no problem. > > I would really like to include this in my testing...is there some > better/more reliable way to test for a response which isn''t a template > response but rather a > > send_file "tmp/SOME.pdf", :type => "application/pdf", :disposition => > ''inline'' >send_file will result in 200, not a 302 (which only happens with a redirect - not what you are doing here). You could check the content type or the response body Fred> That clearly delivers except in testing? > > Craig > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Craig, ----- Original Message ----- Craig White wrote:> the failure is I get response 200 (which is a failure).i don''t mean to "butt in" to your conversation with Fredrick, but what do you mean by "response 200 (which is a failure)". If you mean that you were expecting a 302 and your test failed because you got a 200 which is ''successful'', OK. Otherwise...> so I fired up ''webrick -p 7000 -e test'' and used > a browser and was able to get these stamped PDF''s > without a problem.Exactly. A 200 means the action succeeded. As you saw in the browser.> I would really like to include this in my testing...is there > some better/more reliable way to test for a response > which isn''t a template response but rather a <snip>Are you using fixture_file_upload ? If not, check it out at http://snipplr.com/view/1716/fixturefileupload-example/ HTH, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---