diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-05-06 11:32:41 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-05-06 11:32:41 -0700 |
commit | ae8a01d28c68831fc0f0f720228d0f7f68f6948e (patch) | |
tree | 6846923fda5a5237642058c1a1b4d2a9abfa1fe3 /spec | |
parent | 82d3f655678634fe38dff9796ec937d1a32b77fc (diff) | |
download | ffi-yajl-ae8a01d28c68831fc0f0f720228d0f7f68f6948e.tar.gz |
fixes BracesAroundHashParameters
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ffi_yajl/json_gem_spec.rb | 20 | ||||
-rw-r--r-- | spec/ffi_yajl/parser_spec.rb | 18 |
2 files changed, 19 insertions, 19 deletions
diff --git a/spec/ffi_yajl/json_gem_spec.rb b/spec/ffi_yajl/json_gem_spec.rb index 20004c5..0aa8fda 100644 --- a/spec/ffi_yajl/json_gem_spec.rb +++ b/spec/ffi_yajl/json_gem_spec.rb @@ -90,13 +90,13 @@ describe "JSON Gem Compat API" do after(:all) { JSON.default_options[:symbolize_keys] = @saved_default } it "the default behavior should be to not symbolize keys" do - expect(JSON.parse('{"foo": 1234}')).to eq({ "foo" => 1234 }) + expect(JSON.parse('{"foo": 1234}')).to eq( "foo" => 1234 ) end it "changing the default_options should change the behavior to true" do pending("implement symbolize keys") JSON.default_options[:symbolize_keys] = true - expect(JSON.parse('{"foo": 1234}')).to eq({ :foo => 1234 }) + expect(JSON.parse('{"foo": 1234}')).to eq( :foo => 1234 ) end end @@ -105,24 +105,24 @@ describe "JSON Gem Compat API" do after(:all) { JSON.default_options[:symbolize_names] = @saved_default } it "the default behavior should be to not symbolize keys" do - expect(JSON.parse('{"foo": 1234}')).to eq({ "foo" => 1234 }) + expect(JSON.parse('{"foo": 1234}')).to eq( "foo" => 1234 ) end it "changing the default_options should change the behavior to true" do pending("implement symbolize keys") JSON.default_options[:symbolize_names] = true - expect(JSON.parse('{"foo": 1234}')).to eq({ :foo => 1234 }) + expect(JSON.parse('{"foo": 1234}')).to eq( :foo => 1234 ) end end it "should support passing symbolize_names to JSON.parse" do pending("implement symbolize keys") - expect(JSON.parse('{"foo": 1234}', :symbolize_names => true)).to eq({ :foo => 1234 }) + expect(JSON.parse('{"foo": 1234}', :symbolize_names => true)).to eq( :foo => 1234 ) end it "should support passing symbolize_keys to JSON.parse" do pending("implement symbolize keys") - expect(JSON.parse('{"foo": 1234}', :symbolize_keys => true)).to eq({ :foo => 1234 }) + expect(JSON.parse('{"foo": 1234}', :symbolize_keys => true)).to eq( :foo => 1234 ) end context "when encode arbitrary classes via their default to_json method" do @@ -329,10 +329,10 @@ describe "JSON Gem Compat API" do expect(JSON.parse(@json2)).to eq(JSON.parse(json)) parsed_json = JSON.parse(json) expect(@hash).to eq(parsed_json) - json = JSON.generate({ 1=>2 }) + json = JSON.generate( 1=>2 ) expect('{"1":2}').to eql(json) parsed_json = JSON.parse(json) - expect({ "1"=>2 }).to eq(parsed_json) + expect( "1"=>2 ).to eq(parsed_json) end it "should be able to unparse pretty" do @@ -340,11 +340,11 @@ describe "JSON Gem Compat API" do expect(JSON.parse(@json3)).to eq(JSON.parse(json)) parsed_json = JSON.parse(json) expect(@hash).to eq(parsed_json) - json = JSON.pretty_generate({ 1=>2 }) + json = JSON.pretty_generate( 1=>2 ) test = "{\n \"1\": 2\n}".chomp expect(test).to eq(json) parsed_json = JSON.parse(json) - expect({ "1"=>2 }).to eq(parsed_json) + expect( "1"=>2 ).to eq(parsed_json) end it "JSON.generate should handle nil second argument" do diff --git a/spec/ffi_yajl/parser_spec.rb b/spec/ffi_yajl/parser_spec.rb index ee8f819..60a6e69 100644 --- a/spec/ffi_yajl/parser_spec.rb +++ b/spec/ffi_yajl/parser_spec.rb @@ -29,49 +29,49 @@ describe "FFI_Yajl::Parser" do context "when parsing floats" do it "parses simple floating point values" do json = '{"foo": 3.14159265358979}' - expect(parser.parse(json)).to eql({ "foo" => 3.14159265358979 }) + expect(parser.parse(json)).to eql( "foo" => 3.14159265358979 ) end it "parses simple negative floating point values" do json = '{"foo":-2.00231930436153}' - expect(parser.parse(json)).to eql({ "foo" => -2.00231930436153 }) + expect(parser.parse(json)).to eql( "foo" => -2.00231930436153 ) end it "parses floats with negative exponents and a large E" do json = '{"foo": 1.602176565E-19}' - expect(parser.parse(json)).to eql({ "foo" => 1.602176565e-19 }) + expect(parser.parse(json)).to eql( "foo" => 1.602176565e-19 ) end it "parses floats with negative exponents and a small e" do json = '{"foo": 6.6260689633e-34 }' - expect(parser.parse(json)).to eql({ "foo" => 6.6260689633e-34 }) + expect(parser.parse(json)).to eql( "foo" => 6.6260689633e-34 ) end it "parses floats with positive exponents and a large E" do json = '{"foo": 6.0221413E+23}' - expect(parser.parse(json)).to eql({ "foo" => 6.0221413e+23 }) + expect(parser.parse(json)).to eql( "foo" => 6.0221413e+23 ) end it "parses floats with positive exponents and a small e" do json = '{"foo": 8.9875517873681764e+9 }' - expect(parser.parse(json)).to eql({ "foo" => 8.9875517873681764e+9 }) + expect(parser.parse(json)).to eql( "foo" => 8.9875517873681764e+9 ) end it "parses floats with an exponent without a sign and a large E" do json = '{"foo": 2.99792458E8 }' - expect(parser.parse(json)).to eql({ "foo" => 2.99792458e+8 }) + expect(parser.parse(json)).to eql( "foo" => 2.99792458e+8 ) end it "parses floats with an exponent without a sign and a small e" do json = '{"foo": 1.0973731568539e7 }' - expect(parser.parse(json)).to eql({ "foo" => 1.0973731568539e+7 }) + expect(parser.parse(json)).to eql( "foo" => 1.0973731568539e+7 ) end end context "when parsing unicode in hash keys" do it "handles heavy metal umlauts in keys" do json = '{"München": "Bayern"}' - expect(parser.parse(json)).to eql({ "München" => "Bayern" }) + expect(parser.parse(json)).to eql( "München" => "Bayern" ) end end end |