Skip to content

Commit

Permalink
correction to the outputted controller name in the diagnostics error …
Browse files Browse the repository at this point in the history
…template, test included

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information
joshk authored and spastorino committed Mar 24, 2011
1 parent 35de70f commit c6b3b89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
@@ -1,7 +1,7 @@
<h1> <h1>
<%=h @exception.class.to_s %> <%=h @exception.class.to_s %>
<% if @request.parameters['controller'] %> <% if @request.parameters['controller'] %>
in <%=h @request.parameters['controller'].humanize %>Controller<% if @request.parameters['action'] %>#<%=h @request.parameters['action'] %><% end %> in <%=h @request.parameters['controller'].classify.pluralize %>Controller<% if @request.parameters['action'] %>#<%=h @request.parameters['action'] %><% end %>
<% end %> <% end %>
</h1> </h1>
<pre><%=h @exception.message %></pre> <pre><%=h @exception.message %></pre>
Expand Down
16 changes: 16 additions & 0 deletions actionpack/test/dispatch/show_exceptions_test.rb
Expand Up @@ -20,6 +20,8 @@ class ShowExceptionsTest < ActionController::IntegrationTest
case req.path case req.path
when "/not_found" when "/not_found"
raise ActionController::UnknownAction raise ActionController::UnknownAction
when "/runtime_error"
raise RuntimeError
when "/method_not_allowed" when "/method_not_allowed"
raise ActionController::MethodNotAllowed raise ActionController::MethodNotAllowed
when "/not_implemented" when "/not_implemented"
Expand Down Expand Up @@ -115,4 +117,18 @@ class ShowExceptionsTest < ActionController::IntegrationTest
assert_response 500 assert_response 500
assert_match "&quot;foo&quot;=&gt;&quot;[FILTERED]&quot;", body assert_match "&quot;foo&quot;=&gt;&quot;[FILTERED]&quot;", body
end end

test "show the controller name in the diagnostics template when controller name is present" do
@app = ProductionApp
get("/runtime_error", {}, {
'action_dispatch.show_exceptions' => true,
'action_dispatch.request.parameters' => {
'action' => 'show',
'id' => 'unknown',
'controller' => 'featured_tiles'
}
})
assert_response 500
assert_match(/RuntimeError\n in FeaturedTilesController/, body)
end
end end

0 comments on commit c6b3b89

Please sign in to comment.