diff options
-rw-r--r-- | spec/ffi_yajl/json_gem_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ffi_yajl/json_gem_spec.rb b/spec/ffi_yajl/json_gem_spec.rb index a096b5b..d342fd3 100644 --- a/spec/ffi_yajl/json_gem_spec.rb +++ b/spec/ffi_yajl/json_gem_spec.rb @@ -85,6 +85,18 @@ describe "JSON Gem Compat API" do expect(JSON.respond_to?(:dump)).to be true end + it "JSON#pretty_generate should work with an explicit nil for options" do + expect(JSON.pretty_generate({'foo' => 1234}, nil)).to eql("{\n \"foo\": 1234\n}") + end + + it "JSON#pretty_generate should work without options" do + expect(JSON.pretty_generate({'foo' => 1234})).to eql("{\n \"foo\": 1234\n}") + end + + it "JSON#pretty_generate should work with an empty options hash" do + expect(JSON.pretty_generate({'foo' => 1234}, {})).to eql("{\n \"foo\": 1234\n}") + end + context "when setting symbolize_keys via JSON.default_options" do after(:each) { JSON.default_options[:symbolize_keys] = false } |