|
4 | 4 | class JSONGenericObjectTest < Test::Unit::TestCase |
5 | 5 |
|
6 | 6 | def setup |
7 | | - if defined?(GenericObject) |
| 7 | + if defined?(JSON::GenericObject) |
8 | 8 | @go = JSON::GenericObject[ :a => 1, :b => 2 ] |
9 | 9 | else |
10 | 10 | omit("JSON::GenericObject is not available") |
@@ -40,23 +40,23 @@ def test_parse_json |
40 | 40 | ) |
41 | 41 | assert_equal 1, l.a |
42 | 42 | assert_equal @go, |
43 | | - l = JSON('{ "a": 1, "b": 2 }', :object_class => GenericObject) |
| 43 | + l = JSON('{ "a": 1, "b": 2 }', :object_class => JSON::GenericObject) |
44 | 44 | assert_equal 1, l.a |
45 | | - assert_equal GenericObject[:a => GenericObject[:b => 2]], |
46 | | - l = JSON('{ "a": { "b": 2 } }', :object_class => GenericObject) |
| 45 | + assert_equal JSON::GenericObject[:a => JSON::GenericObject[:b => 2]], |
| 46 | + l = JSON('{ "a": { "b": 2 } }', :object_class => JSON::GenericObject) |
47 | 47 | assert_equal 2, l.a.b |
48 | 48 | end |
49 | 49 | end |
50 | 50 |
|
51 | 51 | def test_from_hash |
52 | 52 | result = JSON::GenericObject.from_hash( |
53 | 53 | :foo => { :bar => { :baz => true }, :quux => [ { :foobar => true } ] }) |
54 | | - assert_kind_of GenericObject, result.foo |
55 | | - assert_kind_of GenericObject, result.foo.bar |
| 54 | + assert_kind_of JSON::GenericObject, result.foo |
| 55 | + assert_kind_of JSON::GenericObject, result.foo.bar |
56 | 56 | assert_equal true, result.foo.bar.baz |
57 | | - assert_kind_of GenericObject, result.foo.quux.first |
| 57 | + assert_kind_of JSON::GenericObject, result.foo.quux.first |
58 | 58 | assert_equal true, result.foo.quux.first.foobar |
59 | | - assert_equal true, GenericObject.from_hash(true) |
| 59 | + assert_equal true, JSON::GenericObject.from_hash(true) |
60 | 60 | end |
61 | 61 |
|
62 | 62 | def test_json_generic_object_load |
|
0 commit comments