diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-09-19 13:22:09 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-09-19 13:22:09 -0500 |
commit | f5ace625fe524938be35ad7d16bc9c29fd08fb96 (patch) | |
tree | 59ab2184fc0eb36e77c90eb2f62768cb4a8daced /actionpack | |
parent | f1c8f07be8c055fdcfd5b5a08b5781e21f24e428 (diff) | |
download | rails-f5ace625fe524938be35ad7d16bc9c29fd08fb96.tar.gz rails-f5ace625fe524938be35ad7d16bc9c29fd08fb96.tar.bz2 rails-f5ace625fe524938be35ad7d16bc9c29fd08fb96.zip |
Ensure changes to I18n locale get reset during tests
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/dispatch/show_exceptions_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/new_base/render_rjs_test.rb | 11 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 14 |
3 files changed, 14 insertions, 14 deletions
diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index ce1973853e..d4800e4edb 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -70,8 +70,7 @@ class ShowExceptionsTest < ActionController::IntegrationTest test "localize public rescue message" do # Change locale - old_locale = I18n.locale - I18n.locale = :da + old_locale, I18n.locale = I18n.locale, :da begin @integration_session = open_session(ProductionApp) diff --git a/actionpack/test/new_base/render_rjs_test.rb b/actionpack/test/new_base/render_rjs_test.rb index 9c6416bbe0..7b76c54ab9 100644 --- a/actionpack/test/new_base/render_rjs_test.rb +++ b/actionpack/test/new_base/render_rjs_test.rb @@ -1,9 +1,7 @@ require 'abstract_unit' module RenderRjs - class BasicController < ActionController::Base - self.view_paths = [ActionView::FixtureResolver.new( "render_rjs/basic/index.js.rjs" => "page[:customer].replace_html render(:partial => 'customer')", "render_rjs/basic/index_html.js.rjs" => "page[:customer].replace_html :partial => 'customer'", @@ -26,6 +24,14 @@ module RenderRjs class TestBasic < SimpleRouteCase testing BasicController + def setup + @old_locale = I18n.locale + end + + def teardown + I18n.locale = @old_locale + end + test "rendering a partial in an RJS template should pick the JS template over the HTML one" do get :index, "format" => "js" assert_response("$(\"customer\").update(\"JS Partial\");") @@ -40,6 +46,5 @@ module RenderRjs get :index_locale, "format" => "js" assert_response("$(\"customer\").update(\"Danish HTML Partial\");") end - end end diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index c86d5215cd..3c192906ae 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -33,18 +33,14 @@ module RenderTestCases end def test_render_file_with_localization - begin - old_locale = I18n.locale - I18n.locale = :da - assert_equal "Hey verden", @view.render(:file => "test/hello_world") - ensure - I18n.locale = old_locale - end + old_locale, I18n.locale = I18n.locale, :da + assert_equal "Hey verden", @view.render(:file => "test/hello_world") + ensure + I18n.locale = old_locale end def test_render_file_with_dashed_locale - old_locale = I18n.locale - I18n.locale = :"pt-BR" + old_locale, I18n.locale = I18n.locale, :"pt-BR" assert_equal "Ola mundo", @view.render(:file => "test/hello_world") ensure I18n.locale = old_locale |