diff options
Diffstat (limited to 'activeresource/test')
-rw-r--r-- | activeresource/test/cases/base_errors_test.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/activeresource/test/cases/base_errors_test.rb b/activeresource/test/cases/base_errors_test.rb index b4fd75fba3..5063916d10 100644 --- a/activeresource/test/cases/base_errors_test.rb +++ b/activeresource/test/cases/base_errors_test.rb @@ -17,7 +17,7 @@ class BaseErrorsTest < Test::Unit::TestCase end end - def test_should_parse_xml_errors + def test_should_parse_json_and_xml_errors [ :json, :xml ].each do |format| invalid_user_using_format(format) do assert_kind_of ActiveResource::Errors, @person.errors @@ -26,6 +26,17 @@ class BaseErrorsTest < Test::Unit::TestCase end end + def test_should_parse_json_errors_when_no_errors_key + ActiveResource::HttpMock.respond_to do |mock| + mock.post "/people.json", {}, '{}', 422, {'Content-Type' => 'application/json; charset=utf-8'} + end + + invalid_user_using_format(:json) do + assert_kind_of ActiveResource::Errors, @person.errors + assert_equal 0, @person.errors.size + end + end + def test_should_parse_errors_to_individual_attributes [ :json, :xml ].each do |format| invalid_user_using_format(format) do |