Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8462

Show
Ignore:
Timestamp:
12/21/07 11:22:03 (9 months ago)
Author:
bitsweat
Message:

Ruby 1.9 compatibility

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activeresource/CHANGELOG

    r8419 r8462  
     1*SVN* 
     2 
     3* Ruby 1.9 compatibility.  [Jeremy Kemper] 
     4 
     5 
    16*2.0.2* (December 16th, 2007) 
    27 
  • trunk/activeresource/lib/active_resource/http_mock.rb

    r8364 r8462  
    1111 
    1212      for method in [ :post, :put, :get, :delete ] 
    13         module_eval <<-EOE 
     13        module_eval <<-EOE, __FILE__, __LINE__ 
    1414          def #{method}(path, request_headers = {}, body = nil, status = 200, response_headers = {}) 
    1515            @responses[Request.new(:#{method}, path, nil, request_headers)] = Response.new(body || "", status, response_headers) 
     
    4848 
    4949    for method in [ :post, :put ] 
    50       module_eval <<-EOE 
     50      module_eval <<-EOE, __FILE__, __LINE__ 
    5151        def #{method}(path, body, headers) 
    5252          request = ActiveResource::Request.new(:#{method}, path, body, headers) 
    5353          self.class.requests << request 
    54           self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for: \#{request.inspect}")) 
     54          self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for \#{request}")) 
    5555        end 
    5656      EOE 
     
    5858 
    5959    for method in [ :get, :delete ] 
    60       module_eval <<-EOE 
     60      module_eval <<-EOE, __FILE__, __LINE__ 
    6161        def #{method}(path, headers) 
    6262          request = ActiveResource::Request.new(:#{method}, path, nil, headers) 
    6363          self.class.requests << request 
    64           self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for: \#{request.inspect}")) 
     64          self.class.responses[request] || raise(InvalidRequestError.new("No response recorded for \#{request}")) 
    6565        end 
    6666      EOE 
     
    7676 
    7777    def initialize(method, path, body = nil, headers = {}) 
    78       @method, @path, @body, @headers = method, path, body, headers.dup 
    79       @headers.update('Content-Type' => 'application/xml') 
     78      @method, @path, @body, @headers = method, path, body, headers.reverse_merge('Content-Type' => 'application/xml') 
    8079    end 
    8180