diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-09-14 16:00:22 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-14 16:00:22 -0300 |
commit | 0ad38412f4278223dbdf46c8c1fd6233e4d54db2 (patch) | |
tree | 1dcd89394dcac5ead83fdd0991f300c28ced5445 /actionpack/lib/action_dispatch | |
parent | 1d7b00d6072e4749e90fb4bc8307dc06b052848d (diff) | |
parent | bc3b0e729282b6474f217806c14f293584dd8c97 (diff) | |
download | rails-0ad38412f4278223dbdf46c8c1fd6233e4d54db2.tar.gz rails-0ad38412f4278223dbdf46c8c1fd6233e4d54db2.tar.bz2 rails-0ad38412f4278223dbdf46c8c1fd6233e4d54db2.zip |
Merge pull request #26477 from kirs/action_dispatch-assert_response
Improve assert_response helper
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/response.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb index a00602ed70..a2eaccd9ef 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/response.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb @@ -79,7 +79,12 @@ module ActionDispatch def generate_response_message(expected, actual = @response.response_code) "Expected response to be a <#{code_with_name(expected)}>,"\ " but was a <#{code_with_name(actual)}>" - .concat location_if_redirected + .concat(location_if_redirected).concat(response_body_if_short) + end + + def response_body_if_short + return "" if @response.body.size > 500 + "\nResponse body: #{@response.body}" end def location_if_redirected |