Sha256: e40f8180baf6726e05e4a353b1ec216361eeef4d745e7528b7afb779165ad255

Contents?: true

Size: 929 Bytes

Versions: 11

Compression:

Stored size: 929 Bytes

Contents

require 'test_helper'

class I18nUnitTest < Minitest::Test
  include Liquid

  def setup
    @i18n = I18n.new(fixture("en_locale.yml"))
  end

  def test_simple_translate_string
    assert_equal "less is more", @i18n.translate("simple")
  end

  def test_nested_translate_string
    assert_equal "something wasn't right", @i18n.translate("errors.syntax.oops")
  end

  def test_single_string_interpolation
    assert_equal "something different", @i18n.translate("whatever", something: "different")
  end

  # def test_raises_translation_error_on_undefined_interpolation_key
  #   assert_raises I18n::TranslationError do
  #     @i18n.translate("whatever", :oopstypos => "yes")
  #   end
  # end

  def test_raises_unknown_translation
    assert_raises I18n::TranslationError do
      @i18n.translate("doesnt_exist")
    end
  end

  def test_sets_default_path_to_en
    assert_equal I18n::DEFAULT_LOCALE, I18n.new.path
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
liquid-4.0.4 test/unit/i18n_unit_test.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/liquid-4.0.3/test/unit/i18n_unit_test.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/liquid-4.0.3/test/unit/i18n_unit_test.rb
liquid-4.0.3 test/unit/i18n_unit_test.rb
liquid-4.0.2 test/unit/i18n_unit_test.rb
liquid-4-0-2-4.0.2 test/unit/i18n_unit_test.rb
liquid-4.0.1 test/unit/i18n_unit_test.rb
liquid-4.0.0 test/unit/i18n_unit_test.rb
liquid-4.0.0.rc3 test/unit/i18n_unit_test.rb
liquid-4.0.0.rc2 test/unit/i18n_unit_test.rb
liquid-4.0.0.rc1 test/unit/i18n_unit_test.rb