aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-05 14:39:52 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-05 14:39:52 -0300
commit1c8192669fd6880041f87ba8ee2aae52b1f7edd8 (patch)
tree399978cbc84f2239fba3aeebce37e9f2287b7fe1 /actionview/test
parentd76bf34b044bb79a82a54a646016797760f8ff6e (diff)
downloadrails-1c8192669fd6880041f87ba8ee2aae52b1f7edd8.tar.gz
rails-1c8192669fd6880041f87ba8ee2aae52b1f7edd8.tar.bz2
rails-1c8192669fd6880041f87ba8ee2aae52b1f7edd8.zip
Avoid changing the global state on the tests
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/translation_helper_test.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb
index 7a3c0a0715..8fde478ac9 100644
--- a/actionview/test/template/translation_helper_test.rb
+++ b/actionview/test/template/translation_helper_test.rb
@@ -14,7 +14,6 @@ class TranslationHelperTest < ActiveSupport::TestCase
attr_reader :request, :view
setup do
- I18n.exception_handler = nil
I18n.backend.store_translations(:en,
:translations => {
:templates => {
@@ -82,13 +81,19 @@ class TranslationHelperTest < ActiveSupport::TestCase
end
def test_uses_custom_exception_handler_when_specified
+ old_exception_handler = I18n.exception_handler
I18n.exception_handler = I18n::CustomExceptionHandler
assert_equal 'from CustomExceptionHandler', translate(:"translations.missing", raise: false)
+ ensure
+ I18n.exception_handler = old_exception_handler
end
def test_uses_custom_exception_handler_when_specified_for_html
+ old_exception_handler = I18n.exception_handler
I18n.exception_handler = I18n::CustomExceptionHandler
assert_equal 'from CustomExceptionHandler', translate(:"translations.missing_html", raise: false)
+ ensure
+ I18n.exception_handler = old_exception_handler
end
def test_i18n_translate_defaults_to_nil_rescue_format