Sha256: d422918ebcac8659552e6f191fae7eb97a447fd9f258e1b3bcc691398e12867a

Contents?: true

Size: 891 Bytes

Versions: 27

Compression:

Stored size: 891 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 = [:a, :b] }
    assert_equal [: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

27 entries across 27 versions & 9 rubygems

Version Path
authlogic-3.4.6 test/i18n_test.rb
authlogic-3.4.5 test/i18n_test.rb
authlogic-3.4.4 test/i18n_test.rb
authlogic-3.4.3 test/i18n_test.rb
authlogic-3.4.2 test/i18n_test.rb
authlogic-3.4.1 test/i18n_test.rb
authlogic-3.4.0 test/i18n_test.rb
authlogic-3.3.0 test/i18n_test.rb
authlogic-3.2.0 test/i18n_test.rb
authlogic-3.1.3 test/i18n_test.rb
authlogic-3.1.2 test/i18n_test.rb
authlogic-3.1.1 test/i18n_test.rb
nulogy-authlogic-3.1.0.1 test/i18n_test.rb
Empact-authlogic-3.1.0 test/i18n_test.rb
authlogic-3.1.0 test/i18n_test.rb
Empact-authlogic-3.0.3 test/i18n_test.rb
antlypls-authlogic-3.0.3 test/i18n_test.rb
authlogic-3.0.3 test/i18n_test.rb
authlogic-3.0.2 test/i18n_test.rb
authlogic-3.0.1 test/i18n_test.rb