aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-06-14 16:31:50 +0200
committerYves Senn <yves.senn@gmail.com>2014-06-14 16:32:02 +0200
commit64220a1de3574ceab70d3ed06e83ee8711ac2204 (patch)
tree0719c1dabf28a165d9f04a80cda43b0a5a1aa527 /actionview
parent5223bad17c9bb103fa6f558e936cc1303ecee4bf (diff)
parent48d118573d3a3b7fd5ba8c4fa02dc2f282a93b0e (diff)
downloadrails-64220a1de3574ceab70d3ed06e83ee8711ac2204.tar.gz
rails-64220a1de3574ceab70d3ed06e83ee8711ac2204.tar.bz2
rails-64220a1de3574ceab70d3ed06e83ee8711ac2204.zip
Merge pull request #15715 from zuhao/refactor_actionview_cleanup_I18n_translations
Clean up I18n stored translations after test.
Diffstat (limited to 'actionview')
-rw-r--r--actionview/test/template/form_helper_test.rb6
-rw-r--r--actionview/test/template/render_test.rb3
-rw-r--r--actionview/test/template/translation_helper_test.rb6
3 files changed, 11 insertions, 4 deletions
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb
index 7b680aac08..48073225cb 100644
--- a/actionview/test/template/form_helper_test.rb
+++ b/actionview/test/template/form_helper_test.rb
@@ -10,9 +10,11 @@ class FormHelperTest < ActionView::TestCase
@output_buffer = super
end
- def setup
- super
+ teardown do
+ I18n.backend.reload!
+ end
+ setup do
# Create "label" locale for testing I18n label helpers
I18n.backend.store_translations 'label', {
activemodel: {
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb
index 240a8e3c32..67f1aabbd2 100644
--- a/actionview/test/template/render_test.rb
+++ b/actionview/test/template/render_test.rb
@@ -12,7 +12,6 @@ module RenderTestCases
@controller_view = TestController.new.view_context
# Reload and register danish language for testing
- I18n.reload!
I18n.backend.store_translations 'da', {}
I18n.backend.store_translations 'pt-BR', {}
@@ -513,6 +512,7 @@ class CachedViewRenderTest < ActiveSupport::TestCase
def teardown
GC.start
+ I18n.reload!
end
end
@@ -530,6 +530,7 @@ class LazyViewRenderTest < ActiveSupport::TestCase
def teardown
GC.start
+ I18n.reload!
end
def test_render_utf8_template_with_magic_comment
diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb
index a9d5ea7345..41f6770f23 100644
--- a/actionview/test/template/translation_helper_test.rb
+++ b/actionview/test/template/translation_helper_test.rb
@@ -6,7 +6,7 @@ class TranslationHelperTest < ActiveSupport::TestCase
attr_reader :request, :view
- def setup
+ setup do
I18n.backend.store_translations(:en,
:translations => {
:templates => {
@@ -30,6 +30,10 @@ class TranslationHelperTest < ActiveSupport::TestCase
@view = ::ActionView::Base.new(ActionController::Base.view_paths, {})
end
+ teardown do
+ I18n.backend.reload!
+ end
+
def test_delegates_to_i18n_setting_the_rescue_format_option_to_html
I18n.expects(:translate).with(:foo, :locale => 'en', :raise=>true).returns("")
translate :foo, :locale => 'en'