aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-07-18 00:38:35 -0700
committerJosé Valim <jose.valim@plataformatec.com.br>2012-07-18 00:38:35 -0700
commit1b39d39af26ae44e4aecb0b48063f08bc5a9a500 (patch)
treef0f3ab78c4adabe4c7588c6ee88537268a6d4333 /actionpack/test
parent58ccc9f6c5d261f7c1305d822b16447ac3d286b3 (diff)
parent1b5298e805a7dec4f5b3c465037dec16cbda4156 (diff)
downloadrails-1b39d39af26ae44e4aecb0b48063f08bc5a9a500.tar.gz
rails-1b39d39af26ae44e4aecb0b48063f08bc5a9a500.tar.bz2
rails-1b39d39af26ae44e4aecb0b48063f08bc5a9a500.zip
Merge pull request #7082 from jalkoby/lazy_lookup_in_abstract_controller
add lazy look up in abstract controller's translate method
Diffstat (limited to 'actionpack/test')
-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