aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
authorGaston Ramos <ramos.gaston@gmail.com>2010-10-06 19:21:01 -0300
committerJosé Valim <jose.valim@gmail.com>2010-10-07 16:50:41 +0200
commitaee043de5a7f1189bd82ce6da20fffbefe36983b (patch)
tree3aa8caa73d0fefd68fa2a1a44f314d965b8a6fe9 /activeresource
parentb9f8501f8249cdc2dc780a7a1255269c63584ef2 (diff)
downloadrails-aee043de5a7f1189bd82ce6da20fffbefe36983b.tar.gz
rails-aee043de5a7f1189bd82ce6da20fffbefe36983b.tar.bz2
rails-aee043de5a7f1189bd82ce6da20fffbefe36983b.zip
- ActiveResource::HttpMock.respond_to
do not replace the response with the same path but different method - Fix typo Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/test/cases/http_mock_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/activeresource/test/cases/http_mock_test.rb b/activeresource/test/cases/http_mock_test.rb
index f15ad04b9a..82b5e60c77 100644
--- a/activeresource/test/cases/http_mock_test.rb
+++ b/activeresource/test/cases/http_mock_test.rb
@@ -140,7 +140,7 @@ class HttpMockTest < ActiveSupport::TestCase
assert_equal 2, ActiveResource::HttpMock.responses.length
end
- test "allows you to add replace the existing reponese with the same path" do
+ test "allows you to replace the existing reponse with the same request" do
ActiveResource::HttpMock.respond_to do |mock|
mock.send(:get, "/people/1", {}, "XML1")
end
@@ -155,6 +155,19 @@ class HttpMockTest < ActiveSupport::TestCase
assert_equal 1, ActiveResource::HttpMock.responses.length
end
+ test "do not replace the response with the same path but different method" do
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.send(:get, "/people/1", {}, "XML1")
+ end
+ assert_equal 1, ActiveResource::HttpMock.responses.length
+
+ put_matz = ActiveResource::Request.new(:put, '/people/1', nil)
+ ok_response = ActiveResource::Response.new("", 200, {})
+
+ ActiveResource::HttpMock.respond_to({put_matz => ok_response}, false)
+ assert_equal 2, ActiveResource::HttpMock.responses.length
+ end
+
def request(method, path, headers = {}, body = nil)
if [:put, :post].include? method
@http.send(method, path, body, headers)