3
class I18nOverrideTest < Test::Unit::TestCase
13
module OverrideSignature
24
@I18n.backend = I18n::Backend::Simple.new
28
test "make sure modules can overwrite I18n methods" do
29
@I18n.extend OverrideInverse
30
@I18n.backend.store_translations('en', :foo => 'bar')
32
assert_equal 'rab', @I18n.translate(:foo, :locale => 'en')
33
# FIXME: this fails under 1.8.7
34
# assert_equal 'rab', @I18n.t(:foo, :locale => 'en')
35
assert_equal 'rab', @I18n.translate!(:foo, :locale => 'en')
36
assert_equal 'rab', @I18n.t!(:foo, :locale => 'en')
39
test "make sure modules can overwrite I18n signature" do
40
exception = catch(:exception) do
41
@I18n.t('Hello', 'Welcome message on home page', :tokenize => true, :throw => true)
43
assert exception.message
44
@I18n.extend OverrideSignature
45
assert_equal 'HelloWelcome message on home page', @I18n.translate('Hello', 'Welcome message on home page', :tokenize => true) # tr8n example