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)
|
|
|
|
new.tap do |resp|
|
|
|
|
resp.status = response.status
|
|
|
|
resp.headers = response.headers
|
|
|
|
resp.body = response.body
|
|
|
|
end
|
|
|
|
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
|
|
|
|
|
|
|
# Were we redirected?
|
2010-08-06 14:24:09 -04:00
|
|
|
alias_method :redirect?, :redirection?
|
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
|