提交 42fa2714 编写于 作者: S Santiago Pastorino 提交者: Jeremy Kemper

Make use of to_xml and to_json in tests

Signed-off-by: NJeremy Kemper <jeremy@bitsweat.net>
上级 7321a3a7
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册