Sha256: 28d0feaeda73afe45f2743cf42e910cca7f6f815ff8b5fd33816a684d28c9a6f
Contents?: true
Size: 837 Bytes
Versions: 7
Compression:
Stored size: 837 Bytes
Contents
require 'test_helper' class Superstore::Types::JsonTypeTest < Superstore::Types::TestCase test 'encode' do assert_equal({a: 'b'}.to_json, coder.encode(a: 'b')) assert_equal '-3', coder.encode(-3) end test 'decode' do assert_equal({'a' => 'b'}, coder.decode({'a' => 'b'}.to_json)) end test 'encode array' do assert_equal(['a', 'b'].to_json, coder.encode(['a', 'b'])) assert_equal '-3', coder.encode(-3) end test 'decode array' do assert_equal(['a', 'b'], coder.decode(['a', 'b'].to_json)) end test 'typecast' do assert_equal({'enabled' => false}, coder.typecast('enabled' => false)) assert_equal({'born_at' => "2004-12-24T00:00:00Z"}, coder.typecast('born_at' => Time.utc(2004, 12, 24))) assert_equal(["2004-12-24T00:00:00Z"], coder.typecast([Time.utc(2004, 12, 24)])) end end
Version data entries
7 entries across 7 versions & 1 rubygems