Sha256: 000a6119f0f425eefa0c6494a0a4f4b6aadc4d5db5dcf9be28c9678e695671cf
Contents?: true
Size: 943 Bytes
Versions: 3
Compression:
Stored size: 943 Bytes
Contents
require 'spec_helper' require 'bson' describe "Hash Keys" do it "should stringify hash parts to be used with BSON" do time = Time.now hash = { :foo => "bar", :bar => Class, "object" => { :a => 1, :b => "1", :c => { :d => 10.5, :e => nil, :f => ["one", "two", "three"] } }, "time" => time, "warden.user.user.key" => "json/bson can't have periods in the keys" } hash.deep_stringify_keys_and_values! hash.should == { "foo" => "bar", "bar" => "Class", "object" => { "a" => 1, "b" => "1", "c" => { "d" => 10.5, "e" => "", "f" => ["one", "two", "three"] } }, "time" => time, "warden-user-user-key" => "json/bson can't have periods in the keys" } lambda { BSON::BSON_CODER.serialize(hash) }.should_not raise_error end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
yogi_berra-0.2.1 | spec/keys_spec.rb |
yogi_berra-0.2.0 | spec/keys_spec.rb |
yogi_berra-0.1.7 | spec/keys_spec.rb |