title: Why doesn't Minitest's assert_raises work as expected in this case?
body: <p>I'm trying to sort out a weird behavior in Rails using the <a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/action_controller_gem.rb" rel="noreferrer">Action Controller bug report template</a>.</p>
  
  <p>For the record, this is the controller in the template:</p>
  
  <pre><code>class TestController &lt; ActionController::Base
    include Rails.application.routes.url_helpers
  
    def index
      render text: 'Home'
    end
  end
  </code></pre>
  
  <p>I've added a route to a missing action:</p>
  
  <pre><code>routes.draw do
    get '/' =&gt; 'test#index'
    get '/missing' =&gt; 'test#missing'
  end
  </code></pre>
  
  <p>and I'm trying to assert that <code>AbstractController::ActionNotFound</code> is raised when following that route:</p>
  
  <pre><code>class BugTest &lt; Minitest::Test
    include Rack::Test::Methods
  
    def test_missing
      assert_raises(AbstractController::ActionNotFound) { get '/missing' }
    end
  
    private
      def app
        Rails.application
      end
  end
  </code></pre>
  
  <p>Expected behavior: green test.</p>
  
  <p>Actual behavior:</p>
  
  <pre><code># Running tests:
  
  D, [2014-04-24T09:17:41.948985 #4497] DEBUG -- :
  D, [2014-04-24T09:17:41.949029 #4497] DEBUG -- :
  I, [2014-04-24T09:17:41.949094 #4497]  INFO -- : Started GET "/missing" for 127.0.0.1 at 2014-04-24 09:17:41 +0200
  F, [2014-04-24T09:17:41.951337 #4497] FATAL -- :
  AbstractController::ActionNotFound (The action 'missing' could not be found for TestController):
  [stacktrace]
  
    1) Failure:
  BugTest#test_missing [action_controller_gem.rb:45]:
  AbstractController::ActionNotFound expected but nothing was raised.
  </code></pre>
  
  <p>So, basically, <strong>the exception is raised but Minitest is claiming nothing was raised.</strong> I am stumped here.</p>
  
  <p>Why can't Minitest assert that <code>AbstractController::ActionNotFound</code> is raised? I've looked into <code>Rack::Test::Methods</code> to rule out that <code>get</code> works with threads or something but couldn't find anything.</p>
  
  <p>I've also looked at the <a href="http://bfts.rubyforge.org/minitest/MiniTest/Assertions.html#method-i-assert_raises" rel="noreferrer">implementation of <code>assert_raises</code></a> -- nothing obvious.</p>
  
  <p><strong>Why doesn't <code>assert_raises(AbstractController::ActionNotFound) { get '/missing' }</code> pass?</strong></p>
  
  <p>(Never mind the fact that this is already tested in Rails. I'm trying to get past this for the real deal.)</p>