1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #15715 from zuhao/refactor_actionview_cleanup_I18n_translations

Clean up I18n stored translations after test.
This commit is contained in:
Yves Senn 2014-06-14 16:31:50 +02:00
commit 64220a1de3
3 changed files with 11 additions and 4 deletions

View file

@ -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: {

View file

@ -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

View file

@ -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'