aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/assertions/response.rb
diff options
context:
space:
mode:
authorVictor Costan <costan@gmail.com>2013-11-24 22:46:58 -0500
committerVictor Costan <costan@gmail.com>2013-11-25 03:09:02 -0500
commitc759a93454b10d9a908d3a3a102546fc70160b91 (patch)
tree1884d7aac3fc0d32bc45bafa7cf53f22a63493eb /actionpack/lib/action_dispatch/testing/assertions/response.rb
parent9dc89f3fc425af5cfc5fa5ea3809e554db017653 (diff)
downloadrails-c759a93454b10d9a908d3a3a102546fc70160b91.tar.gz
rails-c759a93454b10d9a908d3a3a102546fc70160b91.tar.bz2
rails-c759a93454b10d9a908d3a3a102546fc70160b91.zip
Better error message for typos in assert_response argument.
This commit makes it really easy to debug errors due to typos like "assert_response :succezz".
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/assertions/response.rb')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/response.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb
index 93f9fab9c2..68feb26936 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/response.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb
@@ -27,6 +27,9 @@ module ActionDispatch
assert @response.send("#{type}?"), message
else
code = Rack::Utils::SYMBOL_TO_STATUS_CODE[type]
+ if code.nil?
+ raise ArgumentError, "Invalid response type :#{type}"
+ end
assert_equal code, @response.response_code, message
end
else