diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-01-12 19:47:40 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-01-12 19:47:40 -0200 |
commit | 12f4976200019ebc6b699e512691d9e49a5c6988 (patch) | |
tree | 56bca46114756a1e0a338263c15c23ccdd9e8236 /actionpack/test/assertions/response_assertions_test.rb | |
parent | 89f70938d79cc797a4ddad5aa6cc13bfc5cf08c9 (diff) | |
parent | a4032ca07248c057c1507dda474bcdb1d644c810 (diff) | |
download | rails-12f4976200019ebc6b699e512691d9e49a5c6988.tar.gz rails-12f4976200019ebc6b699e512691d9e49a5c6988.tar.bz2 rails-12f4976200019ebc6b699e512691d9e49a5c6988.zip |
Merge pull request #22935 from cllns/add-status-name-to-output
Add HTTP status name to output of tests
Diffstat (limited to 'actionpack/test/assertions/response_assertions_test.rb')
-rw-r--r-- | actionpack/test/assertions/response_assertions_test.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/actionpack/test/assertions/response_assertions_test.rb b/actionpack/test/assertions/response_assertions_test.rb index 841fa6aaad..579ce0ed29 100644 --- a/actionpack/test/assertions/response_assertions_test.rb +++ b/actionpack/test/assertions/response_assertions_test.rb @@ -74,7 +74,18 @@ module ActionDispatch @response.status = 404 error = assert_raises(Minitest::Assertion) { assert_response :success } - expected = "Expected response to be a <success>, but was a <404>" + expected = "Expected response to be a <2XX: success>,"\ + " but was a <404: Not Found>" + assert_match expected, error.message + end + + def test_error_message_shows_404_when_asserted_for_200 + @response = ActionDispatch::Response.new + @response.status = 404 + + error = assert_raises(Minitest::Assertion) { assert_response 200 } + expected = "Expected response to be a <200: OK>,"\ + " but was a <404: Not Found>" assert_match expected, error.message end @@ -84,7 +95,8 @@ module ActionDispatch @response.location = 'http://test.host/posts/redirect/1' error = assert_raises(Minitest::Assertion) { assert_response :success } - expected = "Expected response to be a <success>, but was a <302>" \ + expected = "Expected response to be a <2XX: success>,"\ + " but was a <302: Found>" \ " redirect to <http://test.host/posts/redirect/1>" assert_match expected, error.message end @@ -95,7 +107,8 @@ module ActionDispatch @response.location = 'http://test.host/posts/redirect/2' error = assert_raises(Minitest::Assertion) { assert_response 301 } - expected = "Expected response to be a <301>, but was a <302>" \ + expected = "Expected response to be a <301: Moved Permanently>,"\ + " but was a <302: Found>" \ " redirect to <http://test.host/posts/redirect/2>" assert_match expected, error.message end |