diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-02-06 12:50:45 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-02-06 12:50:45 -0800 |
commit | 9c2918d9749d8aa6071f7aa5aa2500a314e5bafb (patch) | |
tree | 36df1ec1d1f6fe15f11dd5d75ec282bf6c2b31df | |
parent | 4b48f09a9a0916106a644271f10ffab10dfad59d (diff) | |
download | rails-9c2918d9749d8aa6071f7aa5aa2500a314e5bafb.tar.gz rails-9c2918d9749d8aa6071f7aa5aa2500a314e5bafb.tar.bz2 rails-9c2918d9749d8aa6071f7aa5aa2500a314e5bafb.zip |
Fix example and exception message
-rw-r--r-- | activeresource/lib/active_resource/http_mock.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb index acf9ce73e7..7d7e378436 100644 --- a/activeresource/lib/active_resource/http_mock.rb +++ b/activeresource/lib/active_resource/http_mock.rb @@ -123,13 +123,13 @@ module ActiveResource # 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 |