aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-01-30 11:26:44 -0500
committerGitHub <noreply@github.com>2017-01-30 11:26:44 -0500
commit905cececb3dc8e94b1849c36fadba600010926e7 (patch)
tree06c7bf1ba18133b047df581c10967b8aa88bced6
parentd5651436d64c1a3f0b95910cb66c13bb29229f46 (diff)
parentb14ac2f7da5cbae0b6989c50f44d37a8304d86c1 (diff)
downloadrails-905cececb3dc8e94b1849c36fadba600010926e7.tar.gz
rails-905cececb3dc8e94b1849c36fadba600010926e7.tar.bz2
rails-905cececb3dc8e94b1849c36fadba600010926e7.zip
Merge pull request #27846 from kenta-s/improve-insufficient-test-for-safe_join
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