Sha256: a34a1cc986b0f5b3c9f4faba95eb829e4835982e0cb7aeb242fb199d83670a8e

Contents?: true

Size: 288 Bytes

Versions: 26

Compression:

Stored size: 288 Bytes

Contents

describe "Hash#to_json" do
  it "returns a string of all key and value pairs" do
    {}.to_json.should == "{}"
    {"a" => 1, "b" => 2}.to_json.should == '{"a": 1, "b": 2}'

    hash = {"a" => 1, "b" => false, "c" => nil, "d" => true}
    JSON.parse(hash.to_json).should == hash
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
opal-0.4.2 spec/rubyspec/core/hash/to_json_spec.rb
opal-0.4.1 spec/rubyspec/core/hash/to_json_spec.rb
opal-0.4.0 spec/rubyspec/core/hash/to_json_spec.rb
opal-0.3.44 spec/rubyspec/core/hash/to_json_spec.rb
opal-0.3.43 spec/rubyspec/core/hash/to_json_spec.rb
opal-0.3.42 spec/core/hash/to_json_spec.rb
opal-0.3.41 spec/core/hash/to_json_spec.rb
opal-0.3.40 spec/core/hash/to_json_spec.rb
opal-0.3.39 spec/core/hash/to_json_spec.rb
opal-0.3.38 spec/core/hash/to_json_spec.rb
opal-0.3.37 spec/core/hash/to_json_spec.rb
opal-0.3.36 spec/core/hash/to_json_spec.rb
opal-0.3.35 spec/core/hash/to_json_spec.rb
opal-0.3.34 spec/core/hash/to_json_spec.rb
opal-0.3.33 spec/core/hash/to_json_spec.rb
opal-0.3.32 spec/core/hash/to_json_spec.rb
opal-0.3.31 spec/core/hash/to_json_spec.rb
opal-0.3.30 spec/core/hash/to_json_spec.rb
opal-0.3.29 spec/core/hash/to_json_spec.rb
opal-0.3.28 spec/core/hash/to_json_spec.rb