summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2012-10-02 16:27:29 +0200
committerFlorian Frank <flori@ping.de>2012-10-02 16:27:29 +0200
commit01a5165bee5c8cf199e37b3ccc90f1f824d41783 (patch)
treea2cf69fe876ebf0b236d09af683c640b205c34ce /tests
parent2d2b921fe1396b75dcb0f624021fb20062c68600 (diff)
downloadjson-generic-from_hashes.tar.gz
Renamed method and handle arraysjson-generic-from_hashes
Diffstat (limited to 'tests')
-rw-r--r--tests/test_json_generic_object.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_json_generic_object.rb b/tests/test_json_generic_object.rb
index abeb8df..1cec795 100644
--- a/tests/test_json_generic_object.rb
+++ b/tests/test_json_generic_object.rb
@@ -33,10 +33,14 @@ class TestJSONGenericObject < Test::Unit::TestCase
assert_equal 2, l.a.b
end
- def test_from_hashes
- result = GenericObject.from_hashes(:foo => { :bar => { :baz => true } })
+ def test_from_hash
+ result = GenericObject.from_hash(
+ :foo => { :bar => { :baz => true }, :quux => [ { :foobar => true } ] })
assert_kind_of GenericObject, result.foo
assert_kind_of GenericObject, result.foo.bar
assert_equal true, result.foo.bar.baz
+ assert_kind_of GenericObject, result.foo.quux.first
+ assert_equal true, result.foo.quux.first.foobar
+ assert_equal true, GenericObject.from_hash(true)
end
end