aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-08-25 12:05:23 +1000
committerXavier Noria <fxn@hashref.com>2010-08-25 10:00:37 +0200
commitc1b49f1e18e08580196f5acfaacebcf4c3aa17d3 (patch)
tree1098ba22e0169cf2a48762b6226f9d054a8e15e5 /activeresource/test
parent1847d33b4bc776fbd4746c06db41965744377ed6 (diff)
downloadrails-c1b49f1e18e08580196f5acfaacebcf4c3aa17d3.tar.gz
rails-c1b49f1e18e08580196f5acfaacebcf4c3aa17d3.tar.bz2
rails-c1b49f1e18e08580196f5acfaacebcf4c3aa17d3.zip
Make ActiveResource::InvalidRequestError more user friendly
Signed-off-by: Xavier Noria <fxn@hashref.com>
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/cases/http_mock_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activeresource/test/cases/http_mock_test.rb b/activeresource/test/cases/http_mock_test.rb
index 5e032d03f1..a387cd20b1 100644
--- a/activeresource/test/cases/http_mock_test.rb
+++ b/activeresource/test/cases/http_mock_test.rb
@@ -59,6 +59,17 @@ class HttpMockTest < ActiveSupport::TestCase
assert_equal "XML", request(method, "/people/1", FORMAT_HEADER[method] => "application/xml").body
assert_equal "Json", request(method, "/people/1", FORMAT_HEADER[method] => "application/json").body
end
+
+ test "raises InvalidRequestError if no response found for the #{method} request" do
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.send(method, "/people/1", {FORMAT_HEADER[method] => "application/xml"}, "XML")
+ end
+
+ assert_raise(::ActiveResource::InvalidRequestError) do
+ request(method, "/people/1", FORMAT_HEADER[method] => "application/json")
+ end
+ end
+
end
def request(method, path, headers = {}, body = nil)