title: How can I test ActiveRecord::RecordNotFound in my rails app?
body: <p>I have this code in my controller and want to test this code line with a functional test.</p>
  
  <pre><code>raise ActiveRecord::RecordNotFound if @post.nil?
  </code></pre>
  
  <p>which assert method should I use?
  I use the built-in rails 2.3.5 test framework.</p>
  
  <p>I tried it with this code:</p>
  
  <pre><code>  test "should return 404 if page doesn't exist." do
      get :show, :url =&gt; ["nothing", "here"]
      assert_response :missing
    end
  </code></pre>
  
  <p>but it doesn't work for me. Got this test output:</p>
  
  <pre><code>test_should_return_404_if_page_doesn't_exist.(PageControllerTest):
  ActiveRecord::RecordNotFound: ActiveRecord::RecordNotFound
  app/controllers/page_controller.rb:7:in `show'
  /test/functional/page_controller_test.rb:21:in `test_should_return_404_if_page_doesn't_exist.'
  </code></pre>