Sha256: b04b9c9173f2c17da30c2f3ef4d40011b4d3f7ddc42c04390e3334e851b1c9d8
Contents?: true
Size: 980 Bytes
Versions: 62
Compression:
Stored size: 980 Bytes
Contents
require 'test_helper' module Workarea class ApplicationDocumentTest < TestCase class FooModel include ApplicationDocument field :name, type: String, localize: true field :ids, type: Array field :tags, type: Array, localize: true end def test_cleaning_array_values model = FooModel.create!(ids: ['1', '', '2']) assert_equal(['1', '2'], model.ids) end def test_cleaning_array_values_when_nil model = FooModel.create! assert_nil(model.ids) end def test_cleaning_localized_array_values model = FooModel.create!(tags: ['1', '', '2']) assert_equal(['1', '2'], model.tags) end def test_cleaning_when_array_tanslations model = FooModel.create!( tags_translations: { 'en' => [''], 'ts' => nil, 'jp' => ['', 'sale'] } ) assert_equal({ 'en' => [], 'ts' => nil, 'jp' => ['sale']}, model.tags_translations) end end end
Version data entries
62 entries across 62 versions & 1 rubygems