On Dec 1, 2007 5:19 PM, Scott Taylor &lt;<a href="mailto:mailing_lists@railsnewbie.com">mailing_lists@railsnewbie.com</a>&gt; 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>&gt; On 1.12.2007, at 23.27, Scott Taylor wrote:<br>&gt;&gt; &nbsp;it &quot;should return an HTTP status code of 404&quot; do<br>&gt;&gt; &nbsp; &nbsp;get :view
<br>&gt;&gt; &nbsp; &nbsp;response.headers[&quot;Status&quot;].should == &quot;404 Not Found&quot;<br>&gt;<br>&gt; or<br>&gt;<br>&gt; response.response_code.should == 404<br>&gt;<br><br></div>Nice. &nbsp;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&#39;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&#39;s a Test::Unit assertion. Here&#39;s why I use it:<br><br>* I&#39;m not sure if there is a way to do it in RSpec (haven&#39;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>