Sha256: dd464841064f75fec6d471e33101a3934350f11973b644555521c19c923e7635
Contents?: true
Size: 644 Bytes
Versions: 33
Compression:
Stored size: 644 Bytes
Contents
require 'test_helper' module Workarea class MongoidLocalizedDefaultsTest < TestCase class Foo include Mongoid::Document field :name, type: String, default: -> { 'foo' }, localize: true field :config, type: Hash, default: { foo: 'bar' }, localize: true end def test_localized_defaults set_locales(available: [:en, :es], default: :en, current: :en) instance = Foo.new assert_equal('foo', instance.name) assert_equal({ foo: 'bar' }, instance.config) I18n.locale = :es assert_equal('foo', instance.name) assert_equal({ foo: 'bar' }, instance.config) end end end
Version data entries
33 entries across 33 versions & 1 rubygems