Permalink
Browse files

Ruby 1.9 compatibility

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8462 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 8e432d9 commit a1ec3aa6c0e948bfa6e6129b8e60bd38aab46892 @jeremy jeremy committed Dec 21, 2007
Showing with 11 additions and 7 deletions.
  1. +5 −0 activeresource/CHANGELOG
  2. +6 −7 activeresource/lib/active_resource/http_mock.rb
View
@@ -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]
@@ -10,7 +10,7 @@ def initialize(responses)
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 @@ def reset!
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 @@ class Request
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)

0 comments on commit a1ec3aa

Please sign in to comment.