Sha256: 80f65752a45e4ad99901838bdab5fb1943999ef9c6fb846867c22f34981e5f54
Contents?: true
Size: 880 Bytes
Versions: 3
Compression:
Stored size: 880 Bytes
Contents
require 'fidius-common/json_symbol_addon' require 'test/unit' class JSONSymbolAddonTest < Test::Unit::TestCase SIMPLE_HASH_SAMPLE = { :a => 1, :b => 2 } SIMPLE_ARRAY_SAMPLE = [ :a, 1, :b, 2 ] def test_simple_hash json = JSON.parse(SIMPLE_HASH_SAMPLE.to_json) assert_not_equal SIMPLE_HASH_SAMPLE, json assert_equal SIMPLE_HASH_SAMPLE, json.symbolize_keys_if_needed end def test_simple_array json = JSON.parse(SIMPLE_ARRAY_SAMPLE.to_json) assert_not_equal SIMPLE_ARRAY_SAMPLE, json assert_equal SIMPLE_ARRAY_SAMPLE, json.symbolize_keys_if_needed end def test_complex_sample sample = { :array => SIMPLE_ARRAY_SAMPLE, :hash => SIMPLE_HASH_SAMPLE } json = JSON.parse(sample.to_json) assert_not_equal sample, json assert_equal sample, json.symbolize_keys_if_needed end end # class JSONSymbolAddonTest
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fidius-common-0.0.3 | test/test_json_addon.rb |
fidius-common-0.0.2 | test/test_json_addon.rb |
fidius-common-0.0.1 | test/test_json_addon.rb |