Permalink
Browse files

Make use of to_xml and to_json in tests

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 7321a3a commit 42fa2714c5005bb50679bf9a081d8bf0774f7eec @spastorino spastorino committed with jeremy May 5, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 activeresource/test/cases/base_test.rb
View
9 activeresource/test/cases/base_test.rb
@@ -1009,7 +1009,10 @@ def test_exists_with_410_gone
def test_to_xml
matz = Person.find(1)
- xml = matz.encode
+ encode = matz.encode
+ xml = matz.to_xml
+
+ assert encode, xml
assert xml.include?('<?xml version="1.0" encoding="UTF-8"?>')
assert xml.include?('<name>Matz</name>')
assert xml.include?('<id type="integer">1</id>')
@@ -1019,9 +1022,11 @@ def test_to_json
Person.include_root_in_json = true
Person.format = :json
joe = Person.find(6)
- json = joe.encode
+ encode = joe.encode
+ json = joe.to_json
Person.format = :xml
+ assert encode, json
assert_match %r{^\{"person":\{"person":\{}, json
assert_match %r{"id":6}, json
assert_match %r{"name":"Joe"}, json

0 comments on commit 42fa271

Please sign in to comment.