aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-21 11:22:03 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-21 11:22:03 +0000
commita1ec3aa6c0e948bfa6e6129b8e60bd38aab46892 (patch)
treea8f9f8b9427bbc985162f37cac5057cd0ae56701 /activeresource/lib
parent8e432d9a5b4b5bcc3b9ba7b07bb98bb3ed2182f3 (diff)
downloadrails-a1ec3aa6c0e948bfa6e6129b8e60bd38aab46892.tar.gz
rails-a1ec3aa6c0e948bfa6e6129b8e60bd38aab46892.tar.bz2
rails-a1ec3aa6c0e948bfa6e6129b8e60bd38aab46892.zip
Ruby 1.9 compatibility
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8462 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/lib')
-rw-r--r--activeresource/lib/active_resource/http_mock.rb13
1 files changed, 6 insertions, 7 deletions
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)