diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 6fac5e58b354..af26d99fdb86 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -109,9 +109,4 @@ def html_safe def html_safe? false end - - def html_safe! - ActiveSupport::Deprecation.warn("Use html_safe with your strings instead of html_safe! See http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/ for the full story.", caller) - self - end end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index af3ec1260f79..27c2c3b243c8 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -298,11 +298,8 @@ def to_s assert !@string.html_safe? end - test "A string can be marked safe using html_safe!" do - assert_deprecated do - @string.html_safe! - assert @string.html_safe? - end + test "Marking a string html_safe! doesn't work unless rails_xss is installed" do + assert_raise(NoMethodError) { @string.html_safe! } end test "A string can be marked safe" do @@ -310,12 +307,6 @@ def to_s assert string.html_safe? end - test "Marking a string safe returns the string using html_safe!" do - assert_deprecated do - assert_equal @string, @string.html_safe! - end - end - test "Marking a string safe returns the string" do assert_equal @string, @string.html_safe end @@ -336,17 +327,6 @@ def to_s assert string.html_safe? end - test "Adding a safe string to another safe string returns a safe string using html_safe!" do - assert_deprecated do - @other_string = "other".html_safe! - @string.html_safe! - @combination = @other_string + @string - - assert_equal "otherhello", @combination - assert @combination.html_safe? - end - end - test "Adding a safe string to another safe string returns a safe string" do @other_string = "other".html_safe string = @string.html_safe @@ -356,20 +336,6 @@ def to_s assert @combination.html_safe? end - test "Adding an unsafe string to a safe string returns an unsafe string using html_safe!" do - assert_deprecated do - @other_string = "other".html_safe! - @combination = @other_string + "" - @other_combination = @string + "" - - assert_equal "other", @combination - assert_equal "hello", @other_combination - - assert !@combination.html_safe? - assert !@other_combination.html_safe? - end - end - test "Adding an unsafe string to a safe string escapes it and returns a safe string" do @other_string = "other".html_safe @combination = @other_string + "" @@ -382,16 +348,6 @@ def to_s assert !@other_combination.html_safe? end - test "Concatting safe onto unsafe yields unsafe using html_safe!" do - assert_deprecated do - @other_string = "other" - @string.html_safe! - - @other_string.concat(@string) - assert !@other_string.html_safe? - end - end - test "Concatting safe onto unsafe yields unsafe" do @other_string = "other" string = @string.html_safe @@ -400,15 +356,6 @@ def to_s assert !@other_string.html_safe? end - test "Concatting unsafe onto safe yields unsafe using html_safe!" do - assert_deprecated do - @other_string = "other".html_safe! - string = @other_string.concat("") - assert_equal "other", string - assert !string.html_safe? - end - end - test "Concatting unsafe onto safe yields escaped safe" do @other_string = "other".html_safe string = @other_string.concat("") @@ -416,16 +363,6 @@ def to_s assert string.html_safe? end - test "Concatting safe onto safe yields safe using html_safe!" do - assert_deprecated do - @other_string = "other".html_safe! - @string.html_safe! - - @other_string.concat(@string) - assert @other_string.html_safe? - end - end - test "Concatting safe onto safe yields safe" do @other_string = "other".html_safe string = @string.html_safe @@ -434,16 +371,6 @@ def to_s assert @other_string.html_safe? end - test "Concatting safe onto unsafe with << yields unsafe using html_safe!" do - assert_deprecated do - @other_string = "other" - @string.html_safe! - - @other_string << @string - assert !@other_string.html_safe? - end - end - test "Concatting safe onto unsafe with << yields unsafe" do @other_string = "other" string = @string.html_safe @@ -452,15 +379,6 @@ def to_s assert !@other_string.html_safe? end - test "Concatting unsafe onto safe with << yields unsafe using html_safe!" do - assert_deprecated do - @other_string = "other".html_safe! - string = @other_string << "" - assert_equal "other", string - assert !string.html_safe? - end - end - test "Concatting unsafe onto safe with << yields escaped safe" do @other_string = "other".html_safe string = @other_string << "" @@ -468,16 +386,6 @@ def to_s assert string.html_safe? end - test "Concatting safe onto safe with << yields safe using html_safe!" do - assert_deprecated do - @other_string = "other".html_safe! - @string.html_safe! - - @other_string << @string - assert @other_string.html_safe? - end - end - test "Concatting safe onto safe with << yields safe" do @other_string = "other".html_safe @string.html_safe @@ -486,15 +394,6 @@ def to_s assert @other_string.html_safe? end - test "Concatting a fixnum to safe always yields safe using html_safe!" do - assert_deprecated do - @string.html_safe! - @string.concat(13) - assert_equal "hello".concat(13), @string - assert @string.html_safe? - end - end - test "Concatting a fixnum to safe always yields safe" do string = @string.html_safe string = string.concat(13)