From b14ac2f7da5cbae0b6989c50f44d37a8304d86c1 Mon Sep 17 00:00:00 2001 From: kenta-s Date: Mon, 30 Jan 2017 19:44:17 +0900 Subject: Improve insufficient test for `safe_join` --- actionview/test/template/output_safety_helper_test.rb | 15 +++++++++++++-- 1 file 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 -- cgit v1.2.3