4 class SerializerTest < ActiveSupport::TestCase
6 assert_equal('{}', HashSerializer.dump({}))
7 assert_equal('{"foo":"bar"}', HashSerializer.dump(foo: 'bar'))
8 assert_equal('{"foo":"bar"}', HashSerializer.dump('foo' => 'bar'))
9 assert_equal('[]', ArraySerializer.dump([]))
10 assert_equal('["foo",{"foo":"bar"}]',
11 ArraySerializer.dump(['foo', 'foo' => 'bar']))
13 ArraySerializer.load(ArraySerializer.dump([:foo])))
14 assert_equal([1,'bar'],
15 ArraySerializer.load(ArraySerializer.dump([1,'bar'])))
18 test 'load array that was saved as json, then mangled by an old version' do
20 ArraySerializer.load(YAML.dump(ArraySerializer.dump(['foo']))))