From c1d5477b63e73dadec9f284fa55ec22d81f3bf36 Mon Sep 17 00:00:00 2001 From: "Shota Fukumori (sora_h)" Date: Wed, 4 Dec 2013 12:48:21 +0900 Subject: Escalate missing error when :raise is true Before ec16ba75a5493b9da972eea08bae630eba35b62f, ActionView::Helpers::TranslationHelper#translate has raised errors with specifying options[:raise] to true. This should work by this fix: begin t(:"translations.missing", raise: true) rescue I18n::MissingTranslationData p :hello! end --- actionview/test/template/translation_helper_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionview/test') diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb index 0dfe47f5f4..269714fad0 100644 --- a/actionview/test/template/translation_helper_test.rb +++ b/actionview/test/template/translation_helper_test.rb @@ -53,6 +53,12 @@ class TranslationHelperTest < ActiveSupport::TestCase assert_equal false, translate(:"translations.missing", :rescue_format => nil).html_safe? end + def test_raises_missing_translation_message_with_raise_option + assert_raise(I18n::MissingTranslationData) do + translate(:"translations.missing", :raise => true) + end + end + def test_i18n_translate_defaults_to_nil_rescue_format expected = 'translation missing: en.translations.missing' assert_equal expected, I18n.translate(:"translations.missing") -- cgit v1.2.3