From a1ec3aa6c0e948bfa6e6129b8e60bd38aab46892 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 21 Dec 2007 11:22:03 +0000 Subject: Ruby 1.9 compatibility git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8462 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activeresource/CHANGELOG | 5 +++++ activeresource/lib/active_resource/http_mock.rb | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/activeresource/CHANGELOG b/activeresource/CHANGELOG index 243511ca1a..f2a8472649 100644 --- a/activeresource/CHANGELOG +++ b/activeresource/CHANGELOG @@ -1,3 +1,8 @@ +*SVN* + +* Ruby 1.9 compatibility. [Jeremy Kemper] + + *2.0.2* (December 16th, 2007) * Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek] diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb index b54bf09c2d..d70364c5eb 100644 --- a/activeresource/lib/active_resource/http_mock.rb +++ b/activeresource/lib/active_resource/http_mock.rb @@ -10,7 +10,7 @@ module ActiveResource end for method in [ :post, :put, :get, :delete ] - module_eval <<-EOE + module_eval <<-EOE, __FILE__, __LINE__ def #{method}(path, request_headers = {}, body = nil, status = 200, response_headers = {}) @responses[Request.new(:#{method}, path, nil, request_headers)] = Response.new(body || "", status, response_headers) end @@ -47,21 +47,21 @@ module ActiveResource end for method in [ :post, :put ] - module_eval <<-EOE + module_eval <<-EOE, __FILE__, __LINE__ def #{method}(path, body, headers) request = ActiveResource::Request.new(:#{method}, path, body, headers) self.class.requests << request - self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for: \#{request.inspect}")) + self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for \#{request}")) end EOE end for method in [ :get, :delete ] - module_eval <<-EOE + module_eval <<-EOE, __FILE__, __LINE__ def #{method}(path, headers) request = ActiveResource::Request.new(:#{method}, path, nil, headers) self.class.requests << request - self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for: \#{request.inspect}")) + self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for \#{request}")) end EOE end @@ -75,8 +75,7 @@ module ActiveResource attr_accessor :path, :method, :body, :headers def initialize(method, path, body = nil, headers = {}) - @method, @path, @body, @headers = method, path, body, headers.dup - @headers.update('Content-Type' => 'application/xml') + @method, @path, @body, @headers = method, path, body, headers.reverse_merge('Content-Type' => 'application/xml') end def ==(other_request) -- cgit v1.2.3