aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/assertions
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2015-12-06 21:39:59 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2015-12-06 21:39:59 +0530
commitb24711621075350285fed67392720349722f4654 (patch)
treec75bd3c36867355d598b343b245dbc4e08967d11 /actionpack/test/assertions
parent65443ceb0d55e1445b28e31e772629424e6755c3 (diff)
downloadrails-b24711621075350285fed67392720349722f4654.tar.gz
rails-b24711621075350285fed67392720349722f4654.tar.bz2
rails-b24711621075350285fed67392720349722f4654.zip
Use assert over assert_predicate in assert_response
- `assert_predicate` appends its own error message at the end of message generated by `assert_response` and because of that the error message displays the whole `response` object. - For eg. Expected response to be a <success>, but was a redirect to <http://test.host/posts>. Expected #<ActionDispatch::TestResponse:0x007fb1cc1cf6f8....(lambda)>}>> to be successful?. - Complete message can be found here - https://gist.github.com/prathamesh-sonpatki/055afb74b66108e71ded#file-gistfile1-txt-L19. - After this change the message from `assert_predicate` won't be displayed and only message generated by `assert_response` will be shown as follows: Expected response to be a <success>, but was a redirect to <http://test.host/posts>
Diffstat (limited to 'actionpack/test/assertions')
-rw-r--r--actionpack/test/assertions/response_assertions_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/test/assertions/response_assertions_test.rb b/actionpack/test/assertions/response_assertions_test.rb
index 6c7036aa1a..00fb1c0f12 100644
--- a/actionpack/test/assertions/response_assertions_test.rb
+++ b/actionpack/test/assertions/response_assertions_test.rb
@@ -70,8 +70,8 @@ module ActionDispatch
assert_response :success
end
- expected = "Expected response to be a <success>, but was a redirect to <http://test.host/posts/redirect/1>."
- assert_match expected, error.message
+ expected = "Expected response to be a <success>, but was a redirect to <http://test.host/posts/redirect/1>"
+ assert_equal expected, error.message
end
end
end