From cec6f3fe209f0c2312da1e1d091bffd30d6733b0 Mon Sep 17 00:00:00 2001 From: Gaston Ramos Date: Wed, 6 Oct 2010 19:27:25 -0300 Subject: - update documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activeresource/lib/active_resource/http_mock.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activeresource') diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb index 2250ed9c04..9aefde7c30 100644 --- a/activeresource/lib/active_resource/http_mock.rb +++ b/activeresource/lib/active_resource/http_mock.rb @@ -168,6 +168,15 @@ module ActiveResource # # ActiveResource::HttpMock.respond_to(pairs, false) # ActiveResource::HttpMock.responses.length #=> 2 + # + # # If you add a response with an existing request, it will be replaced + # + # fail_response = ActiveResource::Response.new("", 404, {}) + # pairs = {get_matz => fail_response} + # + # ActiveResource::HttpMock.respond_to(pairs, false) + # ActiveResource::HttpMock.responses.length #=> 2 + # def respond_to(*args) #:yields: mock pairs = args.first || {} reset! if args.last.class != FalseClass -- cgit v1.2.3