From 24724288812c8c8892536d0519c019d8a3aea8d1 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sun, 1 May 2011 15:46:01 -0300 Subject: Remove extra whitespaces. --- activeresource/lib/active_resource/http_mock.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activeresource/lib/active_resource/http_mock.rb') diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb index e085a05f6d..02b1192d7e 100644 --- a/activeresource/lib/active_resource/http_mock.rb +++ b/activeresource/lib/active_resource/http_mock.rb @@ -9,8 +9,8 @@ module ActiveResource # requests. # # To test your Active Resource model, you simply call the ActiveResource::HttpMock.respond_to - # method with an attached block. The block declares a set of URIs with expected input, and the output - # each request should return. The passed in block has any number of entries in the following generalized + # method with an attached block. The block declares a set of URIs with expected input, and the output + # each request should return. The passed in block has any number of entries in the following generalized # format: # # mock.http_method(path, request_headers = {}, body = nil, status = 200, response_headers = {}) @@ -29,7 +29,7 @@ module ActiveResource # request_headers listed above. # # In order for a mock to deliver its content, the incoming request must match by the http_method, - # +path+ and request_headers. If no match is found an InvalidRequestError exception + # +path+ and request_headers. If no match is found an +InvalidRequestError+ exception # will be raised showing you what request it could not find a response for and also what requests and response # pairs have been recorded so you can create a new mock for that request. # @@ -80,7 +80,7 @@ module ActiveResource class << self - # Returns an array of all request objects that have been sent to the mock. You can use this to check + # Returns an array of all request objects that have been sent to the mock. You can use this to check # if your model actually sent an HTTP request. # # ==== Example @@ -105,7 +105,7 @@ module ActiveResource end # Returns the list of requests and their mocked responses. Look up a - # response for a request using responses.assoc(request). + # response for a request using responses.assoc(request). def responses @@responses ||= [] end -- cgit v1.2.3 From 06b91381889fcbd32018ab045b1795ada8718cad Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sun, 1 May 2011 15:59:27 -0300 Subject: Added some docs on ActiveResource::HttpMock --- activeresource/lib/active_resource/http_mock.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activeresource/lib/active_resource/http_mock.rb') diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb index 02b1192d7e..3bfd536b29 100644 --- a/activeresource/lib/active_resource/http_mock.rb +++ b/activeresource/lib/active_resource/http_mock.rb @@ -299,6 +299,8 @@ module ActiveResource end end + # Returns true if code is 2xx, + # false otherwise. def success? code.in?(200..299) end @@ -311,6 +313,8 @@ module ActiveResource headers[key] = value end + # Returns true if the other is a Response with an equal body, equal message + # and equal headers. Otherwise it returns false. def ==(other) if (other.is_a?(Response)) other.body == body && other.message == message && other.headers == headers -- cgit v1.2.3