aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/assertions/response_assertions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/assertions/response_assertions.rb')
-rw-r--r--actionpack/lib/action_controller/assertions/response_assertions.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/assertions/response_assertions.rb b/actionpack/lib/action_controller/assertions/response_assertions.rb
index 42bd7fb3d2..67dd3a5724 100644
--- a/actionpack/lib/action_controller/assertions/response_assertions.rb
+++ b/actionpack/lib/action_controller/assertions/response_assertions.rb
@@ -33,7 +33,11 @@ module ActionController
elsif type.is_a?(Symbol) && @response.response_code == ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE[type]
assert_block("") { true } # to count the assertion
else
- assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false }
+ if @response.error?
+ assert_block(build_message(message, "Expected response to be a <?>, but was <?>\n<?>", type, @response.response_code, @response.template.instance_variable_get(:@exception).message)) { false }
+ else
+ assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false }
+ end
end
end
end