aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkenta-s <knt01222@gmail.com>2017-01-30 19:44:17 +0900
committerkenta-s <knt01222@gmail.com>2017-01-30 19:44:17 +0900
commitb14ac2f7da5cbae0b6989c50f44d37a8304d86c1 (patch)
tree039f9968f3267a53439846110ad4c6245ce40532
parent6a1c0218df1fcffaac97e7288db07934bfef277f (diff)
downloadrails-b14ac2f7da5cbae0b6989c50f44d37a8304d86c1.tar.gz
rails-b14ac2f7da5cbae0b6989c50f44d37a8304d86c1.tar.bz2
rails-b14ac2f7da5cbae0b6989c50f44d37a8304d86c1.zip
Improve insufficient test for `safe_join`
-rw-r--r--actionview/test/template/output_safety_helper_test.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/actionview/test/template/output_safety_helper_test.rb b/actionview/test/template/output_safety_helper_test.rb
index 263c25ab49..537b4393ee 100644
--- a/actionview/test/template/output_safety_helper_test.rb
+++ b/actionview/test/template/output_safety_helper_test.rb
@@ -34,8 +34,19 @@ class OutputSafetyHelperTest < ActionView::TestCase
end
test "safe_join should return the safe string separated by $, when second argument is not passed" do
- joined = safe_join(["a", "b"])
- assert_equal "a#{$,}b", joined
+ default_delimeter = $,
+
+ begin
+ $, = nil
+ joined = safe_join(["a", "b"])
+ assert_equal "ab", joined
+
+ $, = "|"
+ joined = safe_join(["a", "b"])
+ assert_equal "a|b", joined
+ ensure
+ $, = default_delimeter
+ end
end
test "to_sentence should escape non-html_safe values" do