This method is deprecated or moved on the latest stable version.
The last existing version (v1.1.6) is shown here.
assert_response(type, message = nil)
public
Asserts that the response is one of the following types:
:success: Status code was 200
:redirect: Status code was in the 300-399 range
:missing: Status code was 404
:error: Status code was in the 500-599 range
You can also pass an explicit status code number as the type, like
assert_response(501)
# File actionpack/lib/action_controller/assertions.rb, line 58
def assert_response(type, message = nil)
clean_backtrace do
if [ :success, :missing, :redirect, :error ].include?(type) && @response.send("#{type}?")
assert_block("") { true } # to count the assertion
elsif type.is_a?(Fixnum) && @response.response_code == type
assert_block("") { true } # to count the assertion
else
assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false }
end
end
end