From 89eca768851b4434fd84e8dd55961b46b5fae74b Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 8 Jan 2025 15:45:05 +0900 Subject: [PATCH] Refactor to omit JSON::GenericObject tests --- test/json/json_generic_object_test.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/json/json_generic_object_test.rb b/test/json/json_generic_object_test.rb index c14f5713..47153419 100644 --- a/test/json/json_generic_object_test.rb +++ b/test/json/json_generic_object_test.rb @@ -2,10 +2,13 @@ require_relative 'test_helper' class JSONGenericObjectTest < Test::Unit::TestCase - include JSON def setup - @go = GenericObject[ :a => 1, :b => 2 ] + if defined?(GenericObject) + @go = JSON::GenericObject[ :a => 1, :b => 2 ] + else + omit("JSON::GenericObject is not available") + end end def test_attributes @@ -46,7 +49,7 @@ def test_parse_json end def test_from_hash - result = GenericObject.from_hash( + result = JSON::GenericObject.from_hash( :foo => { :bar => { :baz => true }, :quux => [ { :foobar => true } ] }) assert_kind_of GenericObject, result.foo assert_kind_of GenericObject, result.foo.bar @@ -79,4 +82,4 @@ def switch_json_creatable ensure JSON::GenericObject.json_creatable = false end -end if defined?(JSON::GenericObject) +end