Permalink
Browse files

Fix example and exception message

  • Loading branch information...
1 parent 4b48f09 commit 9c2918d9749d8aa6071f7aa5aa2500a314e5bafb @jeremy jeremy committed Feb 6, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 activeresource/lib/active_resource/http_mock.rb
@@ -123,13 +123,13 @@ def reset!
# def post(path, body, headers)
# request = ActiveResource::Request.new(:post, path, body, headers)
# self.class.requests << request
- # self.class.responses.assoc(request)[0] || raise(InvalidRequestError.new("No response recorded for #{request}"))
+ # self.class.responses.assoc(request).try(:second) || raise(InvalidRequestError.new("No response recorded for #{request}"))
# end
module_eval <<-EOE, __FILE__, __LINE__
def #{method}(path, #{'body, ' if has_body}headers)
request = ActiveResource::Request.new(:#{method}, path, #{has_body ? 'body, ' : 'nil, '}headers)
self.class.requests << request
- self.class.responses.assoc(request).try(:second) || raise(InvalidRequestError.new("No response recorded for \#{request.inspect} in \#{self.class.responses.select { |req, res| req.path == request.path }.inspect}"))
+ self.class.responses.assoc(request).try(:second) || raise(InvalidRequestError.new("No response recorded for \#{request}"))
end
EOE
end

0 comments on commit 9c2918d

Please sign in to comment.