aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-02 11:23:45 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-02 11:23:45 -0300
commit821f968726617b24340c368f025a78adff731a8f (patch)
tree711bc6ed7936f5796044b025f121c2e236a2090f /activesupport/test
parent3bcc51a4af9fd129f7d4f96ef1a053a36063a040 (diff)
parent848289589edb74767cb97de9ed37a545a8d8b901 (diff)
downloadrails-821f968726617b24340c368f025a78adff731a8f.tar.gz
rails-821f968726617b24340c368f025a78adff731a8f.tar.bz2
rails-821f968726617b24340c368f025a78adff731a8f.zip
Merge pull request #14529 from rwz/master
ActiveSupport::SafeBuffer#prepend inconsistency
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 072b970a2d..4a7c2dac39 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -4,6 +4,7 @@ require 'abstract_unit'
require 'inflector_test_cases'
require 'constantize_test_cases'
+require 'active_support/deprecation/reporting'
require 'active_support/inflector'
require 'active_support/core_ext/string'
require 'active_support/time'
@@ -608,6 +609,27 @@ class OutputSafetyTest < ActiveSupport::TestCase
assert !@other_combination.html_safe?
end
+ test "Prepending safe onto unsafe yields unsafe" do
+ @string.prepend "other".html_safe
+ assert !@string.html_safe?
+ assert_equal @string, "otherhello"
+ end
+
+ test "Prepending unsafe onto safe yields escaped safe" do
+ other = "other".html_safe
+ other.prepend "<foo>"
+ assert other.html_safe?
+ assert_equal other, "&lt;foo&gt;other"
+ end
+
+ test "Deprecated #prepend! method is still present" do
+ ActiveSupport::Deprecation.silence do
+ other = "other".html_safe
+ other.prepend! "<foo>"
+ assert_equal other, "&lt;foo&gt;other"
+ end
+ end
+
test "Concatting safe onto unsafe yields unsafe" do
@other_string = "other"