Sha256: 5a4ea26cca6e69bfe49e2a1517722bc74ed053c5cf15ef7844d0500acebfad17
Contents?: true
Size: 1.25 KB
Versions: 4
Compression:
Stored size: 1.25 KB
Contents
require File.expand_path('../test_helper', __FILE__) class StringifyTest < Minitest::Test def test_stringify_on_hash hash = { :a => 'foo', 'b' => :bar } assert_equal({'a' => 'foo', 'b' => 'bar'}, JSON::Schema.stringify(hash), 'symbol keys should be converted to strings') end def test_stringify_on_array array = [ :a, 'b' ] assert_equal(['a', 'b'], JSON::Schema.stringify(array), 'symbols in an array should be converted to strings') end def test_stringify_on_hash_of_arrays hash = { :a => [:foo], 'b' => :bar } assert_equal({'a' => ['foo'], 'b' => 'bar'}, JSON::Schema.stringify(hash), 'symbols in a nested array should be converted to strings') end def test_stringify_on_array_of_hashes array = [ :a, { :b => :bar } ] assert_equal(['a', {'b' => 'bar'}], JSON::Schema.stringify(array), 'symbols keys in a nested hash should be converted to strings') end def test_stringify_on_hash_of_hashes hash = { :a => { :b => { :foo => :bar } } } assert_equal({'a' => {'b' => {'foo' => 'bar'} } }, JSON::Schema.stringify(hash), 'symbols in a nested hash of hashes should be converted to strings') end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
json-schema-openc-fork-0.0.2 | test/test_stringify.rb |
json-schema-2.5.1 | test/test_stringify.rb |
json-schema-openc-fork-0.0.1 | test/test_stringify.rb |
json-schema-2.5.0 | test/test_stringify.rb |