Sha256: 98dce4bc4d41f28d384a49a0ad26dd81ba1fdf6d7e6b0408a6dffd2bcd894024

Contents?: true

Size: 876 Bytes

Versions: 3

Compression:

Stored size: 876 Bytes

Contents

require "test_helper"

class I18nTest < ActiveSupport::TestCase
  def test_uses_authlogic_as_scope_by_default
    assert_equal :authlogic, Authlogic::I18n.scope
  end

  def test_can_set_scope
    assert_nothing_raised { Authlogic::I18n.scope = %i[a b] }
    assert_equal %i[a b], Authlogic::I18n.scope
    Authlogic::I18n.scope = :authlogic
  end

  def test_uses_built_in_translator_by_default
    assert_equal Authlogic::I18n::Translator, Authlogic::I18n.translator.class
  end

  def test_can_set_custom_translator
    old_translator = Authlogic::I18n.translator

    assert_nothing_raised do
      Authlogic::I18n.translator = Class.new do
        def translate(key, _options = {})
          "Translated: #{key}"
        end
      end.new
    end

    assert_equal "Translated: x", Authlogic::I18n.translate(:x)

    Authlogic::I18n.translator = old_translator
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authlogic-4.2.0 test/i18n_test.rb
authlogic-4.1.1 test/i18n_test.rb
authlogic-4.1.0 test/i18n_test.rb