diff options
Diffstat (limited to 'activeresource/test/connection_test.rb')
-rw-r--r-- | activeresource/test/connection_test.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb index a2744d7531..6e79845aa0 100644 --- a/activeresource/test/connection_test.rb +++ b/activeresource/test/connection_test.rb @@ -44,7 +44,7 @@ class ConnectionTest < Test::Unit::TestCase # 401 is an unauthorized request assert_response_raises ActiveResource::UnauthorizedAccess, 401 - # 403 is a forbidden requst (and authorizing will not help) + # 403 is a forbidden request (and authorizing will not help) assert_response_raises ActiveResource::ForbiddenAccess, 403 # 404 is a missing resource. @@ -120,7 +120,7 @@ class ConnectionTest < Test::Unit::TestCase end def test_get - matz = @conn.get("/people/1.xml") + matz = decode(@conn.get("/people/1.xml")) assert_equal "Matz", matz["name"] end @@ -131,23 +131,23 @@ class ConnectionTest < Test::Unit::TestCase end def test_get_with_header - david = @conn.get("/people/2.xml", @header) + david = decode(@conn.get("/people/2.xml", @header)) assert_equal "David", david["name"] end def test_get_collection - people = @conn.get("/people.xml") + people = decode(@conn.get("/people.xml")) assert_equal "Matz", people[0]["name"] assert_equal "David", people[1]["name"] end - + def test_get_collection_single - people = @conn.get("/people_single_elements.xml") + people = decode(@conn.get("/people_single_elements.xml")) assert_equal "Matz", people[0]["name"] end - + def test_get_collection_empty - people = @conn.get("/people_empty_elements.xml") + people = decode(@conn.get("/people_empty_elements.xml")) assert_equal [], people end @@ -250,4 +250,8 @@ class ConnectionTest < Test::Unit::TestCase def handle_response(response) @conn.__send__(:handle_response, response) end + + def decode(response) + @conn.format.decode(response.body) + end end |