summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-07-12 11:24:13 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-07-12 11:24:13 -0700
commitef4e4184090c30eb66ecc5a52f2f65770a223cea (patch)
tree92bd829929fc50a1a70fd29fe69f49f7f9df8bb0
parent8f1a1ee1c9ee1247ae53d885d91ab41d6ac3da86 (diff)
downloadffi-yajl-ef4e4184090c30eb66ecc5a52f2f65770a223cea.tar.gz
add tests for prett_generate's options hash argument
-rw-r--r--spec/ffi_yajl/json_gem_spec.rb12
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 }