Sha256: 4ba0d757e30411fd00dba0e85f7c50ab5dff63a01d61deab5cfa0148058075c7

Contents?: true

Size: 739 Bytes

Versions: 3

Compression:

Stored size: 739 Bytes

Contents

require 'test_helper'

class RecordsTest < ActiveSupport::TestCase

  test 'associated translation creation' do
    assert_equal 'name', record.name
  end

  test 'associated translation edition' do
    record.name = 'new name'
    record.save!
    assert_equal 'new name', record.name
  end

  test 'associated translation deletion' do
    record.destroy
    assert_nil ModelTranslation.find_by_model_id(record.id)
  end

  test 'locale change' do
    record.with_locale :es
    assert_nil record.name
    record.name = 'new name'
    record.save!
    assert_equal 'new name', record.name
    record.with_locale :en
    assert_equal 'name', record.name
  end

  private

  def record
    @record ||= Model.create(name: 'name')
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
translatable_records-1.1.7 test/records_test.rb
translatable_records-1.1.6 test/records_test.rb
translatable_records-1.1.4 test/records_test.rb