Sha256: 7c6480804f451f5e94b78def1cdcfd86f691fd1fdba231c755af2fcd67f1bf59

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

require 'test_helper'

class ProductTest < ActiveSupport::TestCase

  test 'persistent' do
    product = Product.new

    assert_nil product.name
    product.name = 'phone'
    assert_equal 'phone', product.name
    assert_equal 'en', product.locale

    product.locale = :es
    assert_nil product.name
    product.name = 'teléfono'
    assert_equal 'teléfono', product.name
    assert_equal 'es', product.locale

    product.locale = :en
    assert_equal 'phone', product.name
    assert_equal 'en', product.locale

    product.save!
    product.reload

    assert_equal 'phone', product.name
    assert_equal 'en', product.locale

    product.locale = :es
    assert_equal 'teléfono', product.name
    assert_equal 'es', product.locale

    product.destroy!

    assert_equal 0, ProductTranslation.count
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
translatable_records-4.0.0.1 test/record_test.rb
translatable_records-4.0.0.0 test/record_test.rb