2009-04-30 18:26:03 -04:00
|
|
|
module ActionDispatch
|
2009-09-24 00:37:31 -04:00
|
|
|
# Integration test methods such as ActionDispatch::Integration::Session#get
|
|
|
|
# and ActionDispatch::Integration::Session#post return objects of class
|
2009-05-02 15:23:44 -04:00
|
|
|
# TestResponse, which represent the HTTP response results of the requested
|
|
|
|
# controller actions.
|
|
|
|
#
|
|
|
|
# See Response for more information on controller response objects.
|
2009-04-30 18:26:03 -04:00
|
|
|
class TestResponse < Response
|
|
|
|
def self.from_response(response)
|
2015-09-23 17:39:45 -04:00
|
|
|
new response.status, response.headers, response.body
|
2009-04-30 18:26:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# Was the response successful?
|
2010-08-06 14:24:09 -04:00
|
|
|
alias_method :success?, :successful?
|
2009-04-30 18:26:03 -04:00
|
|
|
|
|
|
|
# Was the URL not found?
|
2010-08-06 14:24:09 -04:00
|
|
|
alias_method :missing?, :not_found?
|
2009-04-30 18:26:03 -04:00
|
|
|
|
|
|
|
# Was there a server-side error?
|
2010-08-06 14:24:09 -04:00
|
|
|
alias_method :error?, :server_error?
|
2009-04-30 18:26:03 -04:00
|
|
|
end
|
|
|
|
end
|