Skip to content

@sferik /gist:089bb90e8da1ad65f6c2 secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
/Users/erik/.rbenv/versions/1.9.3-p125/bin/ruby -S rspec ./spec/multi_json_spec.rb
NSJSONSerialization is exclusively available for MacRuby only.
......................FFF....FF...............................
Failures:
1) MultiJson oj.decode properly decodes valid JSON in StringIOs
Failure/Error: MultiJson.decode(json).should == { 'abc' => 'def' }
TypeError:
wrong argument type StringIO (expected String)
# ./lib/multi_json/engines/oj.rb:10:in `load'
# ./lib/multi_json/engines/oj.rb:10:in `decode'
# ./lib/multi_json.rb:81:in `decode'
# ./spec/multi_json_spec.rb:160:in `block (5 levels) in <top (required)>'
2) MultiJson oj.decode allows for symbolization of keys
Failure/Error: MultiJson.decode(example, :symbolize_keys => true).should == expected
expected: {:abc=>{:def=>"hgi"}}
got: {"abc"=>{"def"=>"hgi"}} (using ==)
Diff:
@@ -1,2 +1,2 @@
-:abc => {:def=>"hgi"}
+"abc" => {"def"=>"hgi"}
# ./spec/multi_json_spec.rb:178:in `block (6 levels) in <top (required)>'
# ./spec/multi_json_spec.rb:168:in `each'
# ./spec/multi_json_spec.rb:168:in `block (5 levels) in <top (required)>'
3) MultiJson oj.decode stringifys symbol keys when encoding
Failure/Error: MultiJson.decode(encoded_json).should == { "a" => 1, "b" => { "c" => 2 } }
expected: {"a"=>1, "b"=>{"c"=>2}}
got: {:a=>1, :b=>{:c=>2}} (using ==)
Diff:
@@ -1,3 +1,3 @@
-"a" => 1,
-"b" => {"c"=>2}
+:a => 1,
+:b => {:c=>2}
# ./spec/multi_json_spec.rb:155:in `block (5 levels) in <top (required)>'
4) MultiJson oj.encode encodes symbol keys as strings
Failure/Error: MultiJson.decode(encoded_json).should == expected
expected: {"foo"=>{"bar"=>"baz"}}
got: {:foo=>{:bar=>"baz"}} (using ==)
Diff:
@@ -1,2 +1,2 @@
-"foo" => {"bar"=>"baz"}
+:foo => {:bar=>"baz"}
# ./spec/multi_json_spec.rb:104:in `block (6 levels) in <top (required)>'
# ./spec/multi_json_spec.rb:93:in `each'
# ./spec/multi_json_spec.rb:93:in `block (5 levels) in <top (required)>'
5) MultiJson oj.encode encodes custom objects which implement as_json
Failure/Error: MultiJson.encode(TimeWithZone.new).should == "\"2005-02-01T15:15:10Z\""
expected: "\"2005-02-01T15:15:10Z\""
got: "{\"^o\":\"TimeWithZone}" (using ==)
# ./spec/multi_json_spec.rb:129:in `block (5 levels) in <top (required)>'
Finished in 0.06524 seconds
62 examples, 5 failures
Failed examples:
rspec ./spec/multi_json_spec.rb:158 # MultiJson oj.decode properly decodes valid JSON in StringIOs
rspec ./spec/multi_json_spec.rb:163 # MultiJson oj.decode allows for symbolization of keys
rspec ./spec/multi_json_spec.rb:153 # MultiJson oj.decode stringifys symbol keys when encoding
rspec ./spec/multi_json_spec.rb:88 # MultiJson oj.encode encodes symbol keys as strings
rspec ./spec/multi_json_spec.rb:128 # MultiJson oj.encode encodes custom objects which implement as_json
Randomized with seed 14770
Coverage report generated for RSpec to /Users/erik/Projects/multi_json/coverage. 240 / 377 LOC (63.66%) covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.