Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After I investigate the Rails source code, it seems like the <code>ActionDispatch::ShowExceptions</code> middleware that responsible of raising exception <code>ActionController::RoutingError</code> is missing in the test environment. Confirmed by running <code>rake middleware</code> and <code>rake middleware RAILS_ENV=test</code>.</p> <p>You can see that in <a href="https://github.com/josh/rack-mount/blob/master/lib/rack/mount/route_set.rb#L152" rel="nofollow">https://github.com/josh/rack-mount/blob/master/lib/rack/mount/route_set.rb#L152</a> it's returning <code>X-Cascade =&gt; 'pass'</code> header, and it's <code>ActionDispatch::ShowExceptions</code>'s responsibility to pick it up (in <a href="https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/show_exceptions.rb#L52" rel="nofollow">https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/show_exceptions.rb#L52</a>)</p> <p>So the reason you're seeing that your test case is passing because <code>rack-mount</code> is returning "Not Found" text, with status 404.</p> <hr> <p>I'll git blame people and get it fix for you. It's this conditional here: <a href="https://github.com/rails/rails/blob/master/railties/lib/rails/application.rb#L159" rel="nofollow">https://github.com/rails/rails/blob/master/railties/lib/rails/application.rb#L159</a>. If the setting is true, the error got translated right but we got error page output. If it's false, then this middleware doesn't get loaded at all. Hold on ... </p> <hr> <p><strong>Update</strong>: To clearify the previous block, you're hitting the dead end here. If you're setting <code>action_dispatch.show_exceptions</code> to <code>false</code>, you'll not get that middleware loaded, resulted in the 404 error from <code>rack-mount</code> got rendered. Whereas if you're setting <code>action_dispatch.show_exceptions</code> to <code>true</code>, that middleware will got loaded but it will rescue the error and render a nice "exception" page for you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload