Sha256: d917f65d5be74e1d29a017150dc294af1676ecb4e5ab37609ed48abd11f6146e

Contents?: true

Size: 920 Bytes

Versions: 29

Compression:

Stored size: 920 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

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

29 entries across 29 versions & 12 rubygems

Version Path
authlogic-2.1.11 test/i18n_test.rb
authlogic-2.1.10 test/i18n_test.rb
jlecour-authlogic-2.1.2 test/i18n_test.rb
authlogic-2.1.8 test/i18n_test.rb
authlogic-2.1.7 test/i18n_test.rb
expertiza-authlogic-2.1.6.1 test/i18n_test.rb
wulffeld_authlogic-2.1.3 test/i18n_test.rb
authlogic-2.1.6 test/i18n_test.rb
lockbox_middleware-1.2.1 vendor/gems/authlogic-2.1.3/test/i18n_test.rb
Empact-authlogic-2.1.5 test/i18n_test.rb
authlogic-2.1.5 test/i18n_test.rb
authlogic-2.1.4 test/i18n_test.rb
Empact-authlogic-2.1.4 test/i18n_test.rb
namxam-authlogic-2.1.3.1 test/i18n_test.rb
drogus-authlogic-2.1.3 test/i18n_test.rb
novelys_authlogic-2.1.6 test/i18n_test.rb
novelys_authlogic-2.1.5 test/i18n_test.rb
novelys_authlogic-2.1.4 test/i18n_test.rb
novelys_authlogic-2.1.3 test/i18n_test.rb
ginst-2009.12.8 vendor/plugins/authlogic/test/i18n_test.rb