Refactor to omit JSON::GenericObject tests
This commit is contained in:
parent
6bff923d2f
commit
9f5ca6332b
Notes:
git
2025-01-08 08:12:42 +00:00
@ -2,10 +2,13 @@
|
|||||||
require_relative 'test_helper'
|
require_relative 'test_helper'
|
||||||
|
|
||||||
class JSONGenericObjectTest < Test::Unit::TestCase
|
class JSONGenericObjectTest < Test::Unit::TestCase
|
||||||
include JSON
|
|
||||||
|
|
||||||
def setup
|
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
|
end
|
||||||
|
|
||||||
def test_attributes
|
def test_attributes
|
||||||
@ -46,7 +49,7 @@ class JSONGenericObjectTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_from_hash
|
def test_from_hash
|
||||||
result = GenericObject.from_hash(
|
result = JSON::GenericObject.from_hash(
|
||||||
:foo => { :bar => { :baz => true }, :quux => [ { :foobar => true } ] })
|
:foo => { :bar => { :baz => true }, :quux => [ { :foobar => true } ] })
|
||||||
assert_kind_of GenericObject, result.foo
|
assert_kind_of GenericObject, result.foo
|
||||||
assert_kind_of GenericObject, result.foo.bar
|
assert_kind_of GenericObject, result.foo.bar
|
||||||
@ -79,4 +82,4 @@ class JSONGenericObjectTest < Test::Unit::TestCase
|
|||||||
ensure
|
ensure
|
||||||
JSON::GenericObject.json_creatable = false
|
JSON::GenericObject.json_creatable = false
|
||||||
end
|
end
|
||||||
end if defined?(JSON::GenericObject)
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user