From b09b2a8401c18d1efff21b3919ac280470a6eb8b Mon Sep 17 00:00:00 2001 From: Denis Odorcic Date: Fri, 16 Sep 2011 11:04:12 -0400 Subject: Fix ActiveResource JSON error parser and incorrect tests --- activeresource/test/cases/base_errors_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activeresource/test') diff --git a/activeresource/test/cases/base_errors_test.rb b/activeresource/test/cases/base_errors_test.rb index 5063916d10..a1766cdb21 100644 --- a/activeresource/test/cases/base_errors_test.rb +++ b/activeresource/test/cases/base_errors_test.rb @@ -5,7 +5,7 @@ class BaseErrorsTest < Test::Unit::TestCase def setup ActiveResource::HttpMock.respond_to do |mock| mock.post "/people.xml", {}, %q(Age can't be blankName can't be blankName must start with a letterPerson quota full for today.), 422, {'Content-Type' => 'application/xml; charset=utf-8'} - mock.post "/people.json", {}, %q({"errors":["Age can't be blank","Name can't be blank","Name must start with a letter","Person quota full for today."]}), 422, {'Content-Type' => 'application/json; charset=utf-8'} + mock.post "/people.json", {}, %q({"errors":{"age":["can't be blank"],"name":["can't be blank", "must start with a letter"],"person":["quota full for today."]}}), 422, {'Content-Type' => 'application/json; charset=utf-8'} end end @@ -83,7 +83,7 @@ class BaseErrorsTest < Test::Unit::TestCase def test_should_mark_as_invalid_when_content_type_is_unavailable_in_response_header ActiveResource::HttpMock.respond_to do |mock| mock.post "/people.xml", {}, %q(Age can't be blankName can't be blankName must start with a letterPerson quota full for today.), 422, {} - mock.post "/people.json", {}, %q({"errors":["Age can't be blank","Name can't be blank","Name must start with a letter","Person quota full for today."]}), 422, {} + mock.post "/people.json", {}, %q({"errors":{"age":["can't be blank"],"name":["can't be blank", "must start with a letter"],"person":["quota full for today."]}}), 422, {} end [ :json, :xml ].each do |format| -- cgit v1.2.3