From 9c2918d9749d8aa6071f7aa5aa2500a314e5bafb Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 6 Feb 2009 12:50:45 -0800 Subject: [PATCH] Fix example and exception message --- activeresource/lib/active_resource/http_mock.rb | 4 ++-- 1 file 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