aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorSameer Rahmani <lxsameer@gnu.org>2015-12-01 19:19:44 +0330
committerSameer Rahmani <lxsameer@gnu.org>2015-12-18 22:45:05 +0330
commitc1dbb13eacf0e579f351a46c9ee2ec845ae0cc2d (patch)
treec2fef94c1127e7732ed7ab87728d522960fbdad6 /actionview/test
parentcd53b05be8f74dfc9c872eb1e84cd024e754f48d (diff)
downloadrails-c1dbb13eacf0e579f351a46c9ee2ec845ae0cc2d.tar.gz
rails-c1dbb13eacf0e579f351a46c9ee2ec845ae0cc2d.tar.bz2
rails-c1dbb13eacf0e579f351a46c9ee2ec845ae0cc2d.zip
debug_missing_translation configuration added to action_view
`I18n.translate` helper will wrap the missing translation keys in a <span> tag only if `debug_missing_translation` configuration has a truthy value. Default value is `true`. For example in `application.rb`: # in order to turn off missing key wrapping config.action_view.debug_missing_translation = false
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/translation_helper_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb
index 631bceadd8..597936d7ae 100644
--- a/actionview/test/template/translation_helper_test.rb
+++ b/actionview/test/template/translation_helper_test.rb
@@ -54,6 +54,16 @@ class TranslationHelperTest < ActiveSupport::TestCase
end
end
+ def test_returns_missing_tranlation_message_without_span_wrap
+ old_value = ActionView::Base.debug_missing_translation
+ ActionView::Base.debug_missing_translation = false
+
+ expected = 'translation missing: en.translations.missing'
+ assert_equal expected, translate(:"translations.missing")
+ ensure
+ ActionView::Base.debug_missing_translation = old_value
+ end
+
def test_returns_missing_translation_message_wrapped_into_span
expected = '<span class="translation_missing" title="translation missing: en.translations.missing">Missing</span>'
assert_equal expected, translate(:"translations.missing")