summaryrefslogtreecommitdiff
path: root/test/json/json_addition_test.rb
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-03-27 10:34:17 +0100
committerHiroshi SHIBATA <[email protected]>2025-03-28 12:44:53 +0900
commit756b75f2421008a46ee68390c683ca2c1a0ddc31 (patch)
treebabcd374b16cae7ab40c11be176e32661a693b5d /test/json/json_addition_test.rb
parent96ecac1e245aaac4484f69a731d2af4328760a8e (diff)
[ruby/json] Remove `Class#json_creatable?` monkey patch.
https://github.com/ruby/json/commit/1ca7efed1f
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13004
Diffstat (limited to 'test/json/json_addition_test.rb')
-rw-r--r--test/json/json_addition_test.rb14
1 files changed, 1 insertions, 13 deletions
diff --git a/test/json/json_addition_test.rb b/test/json/json_addition_test.rb
index 1eb269c2f6..4d8d186873 100644
--- a/test/json/json_addition_test.rb
+++ b/test/json/json_addition_test.rb
@@ -44,10 +44,6 @@ class JSONAdditionTest < Test::Unit::TestCase
end
class B
- def self.json_creatable?
- false
- end
-
def to_json(*args)
{
'json_class' => self.class.name,
@@ -56,10 +52,6 @@ class JSONAdditionTest < Test::Unit::TestCase
end
class C
- def self.json_creatable?
- false
- end
-
def to_json(*args)
{
'json_class' => 'JSONAdditionTest::Nix',
@@ -69,7 +61,6 @@ class JSONAdditionTest < Test::Unit::TestCase
def test_extended_json
a = A.new(666)
- assert A.json_creatable?
json = generate(a)
a_again = parse(json, :create_additions => true)
assert_kind_of a.class, a_again
@@ -78,7 +69,7 @@ class JSONAdditionTest < Test::Unit::TestCase
def test_extended_json_default
a = A.new(666)
- assert A.json_creatable?
+ assert A.respond_to?(:json_create)
json = generate(a)
a_hash = parse(json)
assert_kind_of Hash, a_hash
@@ -86,7 +77,6 @@ class JSONAdditionTest < Test::Unit::TestCase
def test_extended_json_disabled
a = A.new(666)
- assert A.json_creatable?
json = generate(a)
a_again = parse(json, :create_additions => true)
assert_kind_of a.class, a_again
@@ -101,14 +91,12 @@ class JSONAdditionTest < Test::Unit::TestCase
def test_extended_json_fail1
b = B.new
- assert !B.json_creatable?
json = generate(b)
assert_equal({ "json_class"=>"JSONAdditionTest::B" }, parse(json))
end
def test_extended_json_fail2
c = C.new
- assert !C.json_creatable?
json = generate(c)
assert_raise(ArgumentError, NameError) { parse(json, :create_additions => true) }
end