diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-08-07 14:24:20 -0500 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-08-07 16:38:18 -0500 |
commit | 5d260103d3f11897e7873fb3fa796966896ff946 (patch) | |
tree | 405786d255997ddf66c49e569bd7a08b9766d97d /spec | |
parent | 199bcc2304bc032559ca0b9f82978b4ebb64fe41 (diff) | |
download | ffi-yajl-5d260103d3f11897e7873fb3fa796966896ff946.tar.gz |
fix for chef pretty printing issues
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ffi_yajl/json_gem_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ffi_yajl/json_gem_spec.rb b/spec/ffi_yajl/json_gem_spec.rb index d342fd3..36233eb 100644 --- a/spec/ffi_yajl/json_gem_spec.rb +++ b/spec/ffi_yajl/json_gem_spec.rb @@ -97,6 +97,17 @@ describe "JSON Gem Compat API" do expect(JSON.pretty_generate({'foo' => 1234}, {})).to eql("{\n \"foo\": 1234\n}") end + class Foo + def to_json(*a) + {'foo' => 1234}.to_json(*a) + end + end + + it "JSON#pretty_generate should work with an Object that implements #to_json" do + f = Foo.new + expect(JSON.pretty_generate(f)).to eql("{\n \"foo\": 1234\n}\n") + end + context "when setting symbolize_keys via JSON.default_options" do after(:each) { JSON.default_options[:symbolize_keys] = false } |