On Dec 1, 2007 5:19 PM, Scott Taylor <<a href="mailto:mailing_lists@railsnewbie.com">mailing_lists@railsnewbie.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>On Dec 1, 2007, at 5:10 PM, Jarkko Laine wrote:<br><br>> On 1.12.2007, at 23.27, Scott Taylor wrote:<br>>> it "should return an HTTP status code of 404" do<br>>> get :view
<br>>> response.headers["Status"].should == "404 Not Found"<br>><br>> or<br>><br>> response.response_code.should == 404<br>><br><br></div>Nice. I find out something new every day from this list.
</blockquote><div><br>You might also look at status_codes.rb. For example, if you have rails in vendor/rails, it's path is<br><br>vendor/rails/actionpack/lib/action_controller/status_codes.rb<br><br>For any status in that file, you should be able to do this in your examples:
<br><br>assert_response :not_found<br><br>Yes, that's a Test::Unit assertion. Here's why I use it:<br><br>* I'm not sure if there is a way to do it in RSpec (haven't yet investigated)<br>* I can use Test::Unit assertions in RSpec (really cool)
<br>* I like the way it reads compared to using the codes, such as 404<br><br>Regards,<br>Craig<br></div></div>