In your test, you mentioned the type of response as: an error that corresponds to status code 500-599. But as your test returns a status code of 201, it cannot match this and show the message according to the definition of assert_response, which is
def assert_response(type, message = nil) clean_backtrace do if [ :success, :missing, :redirect, :error ].include?(type) && @response.send("#{type}?") assert_block("") { true }
it switches to another due to a mismatch of the type and status of the code and gives this message.
Here are the response type and match codes:
: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
abhas source share