summaryrefslogtreecommitdiff
path: root/test/json/json_generator_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/json/json_generator_test.rb')
-rwxr-xr-xtest/json/json_generator_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb
index 824de2c1a6..92115637e1 100755
--- a/test/json/json_generator_test.rb
+++ b/test/json/json_generator_test.rb
@@ -200,6 +200,7 @@ class JSONGeneratorTest < Test::Unit::TestCase
assert_equal({
:allow_nan => false,
:array_nl => "\n",
+ :as_json => false,
:ascii_only => false,
:buffer_initial_length => 1024,
:depth => 0,
@@ -218,6 +219,7 @@ class JSONGeneratorTest < Test::Unit::TestCase
assert_equal({
:allow_nan => false,
:array_nl => "",
+ :as_json => false,
:ascii_only => false,
:buffer_initial_length => 1024,
:depth => 0,
@@ -236,6 +238,7 @@ class JSONGeneratorTest < Test::Unit::TestCase
assert_equal({
:allow_nan => false,
:array_nl => "",
+ :as_json => false,
:ascii_only => false,
:buffer_initial_length => 1024,
:depth => 0,
@@ -666,4 +669,9 @@ class JSONGeneratorTest < Test::Unit::TestCase
fragment = JSON::Fragment.new(" 42")
assert_equal '{"number": 42}', JSON.generate({ number: fragment })
end
+
+ def test_json_generate_as_json_convert_to_proc
+ object = Object.new
+ assert_equal object.object_id.to_json, JSON.generate(object, strict: true, as_json: :object_id)
+ end
end