From c759a93454b10d9a908d3a3a102546fc70160b91 Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Sun, 24 Nov 2013 22:46:58 -0500 Subject: 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". --- actionpack/lib/action_dispatch/testing/assertions/response.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack/lib') 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 -- cgit v1.2.3