aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2019-02-21 23:57:45 -0500
committerGeorge Claghorn <george@basecamp.com>2019-02-21 23:57:45 -0500
commit2083f387350e6493b511cf25b100b01b36f605c8 (patch)
tree1c1700a91213ad1f64ba4ee90436eae9b5c57311 /actionview/test/template/form_helper
parent7351ccdb880ca4b69d24b2615019ed902652f45e (diff)
downloadrails-2083f387350e6493b511cf25b100b01b36f605c8.tar.gz
rails-2083f387350e6493b511cf25b100b01b36f605c8.tar.bz2
rails-2083f387350e6493b511cf25b100b01b36f605c8.zip
Prefer I18n.with_locale
Diffstat (limited to 'actionview/test/template/form_helper')
-rw-r--r--actionview/test/template/form_helper/form_with_test.rb17
1 files changed, 5 insertions, 12 deletions
diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb
index f84c9b2b73..42069340f1 100644
--- a/actionview/test/template/form_helper/form_with_test.rb
+++ b/actionview/test/template/form_helper/form_with_test.rb
@@ -994,7 +994,7 @@ class FormWithActsLikeFormForTest < FormWithTest
end
def test_submit_with_object_as_new_record_and_locale_strings
- with_locale :submit do
+ I18n.with_locale :submit do
@post.persisted = false
@post.stub(:to_key, nil) do
form_with(model: @post) do |f|
@@ -1011,7 +1011,7 @@ class FormWithActsLikeFormForTest < FormWithTest
end
def test_submit_with_object_as_existing_record_and_locale_strings
- with_locale :submit do
+ I18n.with_locale :submit do
form_with(model: @post) do |f|
concat f.submit
end
@@ -1025,7 +1025,7 @@ class FormWithActsLikeFormForTest < FormWithTest
end
def test_submit_without_object_and_locale_strings
- with_locale :submit do
+ I18n.with_locale :submit do
form_with(scope: :post) do |f|
concat f.submit class: "extra"
end
@@ -1039,7 +1039,7 @@ class FormWithActsLikeFormForTest < FormWithTest
end
def test_submit_with_object_which_is_overwritten_by_scope_option
- with_locale :submit do
+ I18n.with_locale :submit do
form_with(model: @post, scope: :another_post) do |f|
concat f.submit
end
@@ -1054,7 +1054,7 @@ class FormWithActsLikeFormForTest < FormWithTest
def test_submit_with_object_which_is_namespaced
blog_post = Blog::Post.new("And his name will be forty and four.", 44)
- with_locale :submit do
+ I18n.with_locale :submit do
form_with(model: blog_post) do |f|
concat f.submit
end
@@ -2357,11 +2357,4 @@ class FormWithActsLikeFormForTest < FormWithTest
def protect_against_forgery?
false
end
-
- def with_locale(testing_locale = :label)
- old_locale, I18n.locale = I18n.locale, testing_locale
- yield
- ensure
- I18n.locale = old_locale
- end
end