aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/response.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-04-30 14:28:42 -0500
committerJoshua Peek <josh@joshpeek.com>2009-04-30 14:28:42 -0500
commit9bac470c7ac7bc15830a66f416358d8efc74a39d (patch)
tree1b06508f16eb377a732a4f303ea216ff2eb6b60e /actionpack/lib/action_dispatch/http/response.rb
parentba9887c9c02a3671c3d1d893cbee9f360ea2df2d (diff)
downloadrails-9bac470c7ac7bc15830a66f416358d8efc74a39d.tar.gz
rails-9bac470c7ac7bc15830a66f416358d8efc74a39d.tar.bz2
rails-9bac470c7ac7bc15830a66f416358d8efc74a39d.zip
Group integration test helpers and delegate other helpers to request and response objects
Diffstat (limited to 'actionpack/lib/action_dispatch/http/response.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index d104dcb8a0..1b12308cc9 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -31,6 +31,14 @@ module ActionDispatch # :nodoc:
# end
# end
class Response < Rack::Response
+ def self.from_response(response)
+ new.tap do |resp|
+ resp.status = response.status
+ resp.headers = response.headers
+ resp.body = response.body
+ end
+ end
+
DEFAULT_HEADERS = { "Cache-Control" => "no-cache" }
attr_accessor :request
@@ -80,6 +88,7 @@ module ActionDispatch # :nodoc:
def message
status.to_s.split(' ',2)[1] || StatusCodes::STATUS_CODES[response_code]
end
+ alias_method :status_message, :message
# Was the response successful?
def success?