aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2017-01-25 09:35:39 +0900
committeryui-knk <spiketeika@gmail.com>2017-01-25 09:35:39 +0900
commitf7950b480c0acf7fdc7be948a58dabbefc105855 (patch)
tree131c81f34bb4b711c14e132f7414b41ead786023
parent6363fa1a6f9ef43b3e89e8cf5873617e851414d4 (diff)
downloadrails-f7950b480c0acf7fdc7be948a58dabbefc105855.tar.gz
rails-f7950b480c0acf7fdc7be948a58dabbefc105855.tar.bz2
rails-f7950b480c0acf7fdc7be948a58dabbefc105855.zip
Keep the value of `$,` and restore it
As unit tests, we do not know the value of `$,` when this test case started. It' better to keep the value when the test case fnished.
-rw-r--r--actionview/test/template/output_safety_helper_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/test/template/output_safety_helper_test.rb b/actionview/test/template/output_safety_helper_test.rb
index 0f3288130b..263c25ab49 100644
--- a/actionview/test/template/output_safety_helper_test.rb
+++ b/actionview/test/template/output_safety_helper_test.rb
@@ -94,12 +94,13 @@ class OutputSafetyHelperTest < ActionView::TestCase
end
test "to_sentence is not affected by $," do
+ separator_was = $,
$, = "|"
begin
assert_equal "one and two", to_sentence(["one", "two"])
assert_equal "one, two, and three", to_sentence(["one", "two", "three"])
ensure
- $, = nil
+ $, = separator_was
end
end
end