aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/abstract/translation_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/abstract/translation_test.rb')
-rw-r--r--actionpack/test/abstract/translation_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/abstract/translation_test.rb b/actionpack/test/abstract/translation_test.rb
index 0194ee943f..99064a8b87 100644
--- a/actionpack/test/abstract/translation_test.rb
+++ b/actionpack/test/abstract/translation_test.rb
@@ -23,4 +23,17 @@ class TranslationControllerTest < ActiveSupport::TestCase
def test_action_controller_base_responds_to_l
assert_respond_to @controller, :l
end
+
+ def test_lazy_lookup
+ expected = 'bar'
+ @controller.stubs(:action_name => :index)
+ I18n.stubs(:translate).with('action_controller.base.index.foo').returns(expected)
+ assert_equal expected, @controller.t('.foo')
+ end
+
+ def test_default_translation
+ key, expected = 'one.two' 'bar'
+ I18n.stubs(:translate).with(key).returns(expected)
+ assert_equal expected, @controller.t(key)
+ end
end