Class: ActionDispatch::TestResponse

Inherits:
Response show all
Defined in:
actionpack/lib/action_dispatch/testing/test_response.rb

Overview

Integration test methods such as ActionDispatch::Integration::Session#get and ActionDispatch::Integration::Session#post return objects of class TestResponse, which represent the HTTP response results of the requested controller actions.

See Response for more information on controller response objects.

Constant Summary

Constant Summary

Constants inherited from Response

Response::CONTENT_TYPE, Response::EMPTY

Constants included from Http::Cache::Response

Http::Cache::Response::DEFAULT_CACHE_CONTROL

Instance Attribute Summary

Attributes inherited from Response

#blank, #charset, #content_type, #header, #request, #sending_file

Attributes included from Http::Cache::Response

#cache_control, #etag

Class Method Summary (collapse)

Methods inherited from Response

#body, #body=, #body_parts, #code, #cookies, #each, #location, #location=, #message, #respond_to?, #response_code, #status=, #to_a, #to_path, #write

Methods included from Http::Cache::Response

#initialize, #last_modified, #last_modified=, #last_modified?

Methods included from Response::Setup

#initialize

Class Method Details

+ (Object) from_response(response)



9
10
11
12
13
14
15
# File 'actionpack/lib/action_dispatch/testing/test_response.rb', line 9

def self.from_response(response)
  new.tap do |resp|
    resp.status  = response.status
    resp.headers = response.headers
    resp.body    = response.body
  end
end