diff options
author | Yehuda Katz <wycats@Yehuda-Katz.local> | 2009-12-27 14:36:59 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@Yehuda-Katz.local> | 2009-12-27 14:36:59 -0800 |
commit | 12e43494a748e0144195be12dc19161cc3e4d39f (patch) | |
tree | c06f88b7ddf6e41205838cc6f4edd2257a801dcb /activesupport/test/core_ext | |
parent | 1c26ba486c23f229a12fea6ccad33e6cb3122b91 (diff) | |
parent | 97db79ab3c0af7b6805dcaee99384d96ccb3567d (diff) | |
download | rails-12e43494a748e0144195be12dc19161cc3e4d39f.tar.gz rails-12e43494a748e0144195be12dc19161cc3e4d39f.tar.bz2 rails-12e43494a748e0144195be12dc19161cc3e4d39f.zip |
Merge remote branch 'jose/perf'
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 56ed296dac..6ed209f724 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -350,6 +350,24 @@ class OutputSafetyTest < ActiveSupport::TestCase assert_equal @string, @string.html_safe! end + test "A fixnum is safe by default" do + assert 5.html_safe? + end + + test "An object is unsafe by default" do + klass = Class.new(Object) do + def to_str + "other" + end + end + + @string.html_safe! + @string << klass.new + + assert_equal "helloother", @string + assert !@string.html_safe? + end + test "Adding a safe string to another safe string returns a safe string" do @other_string = "other".html_safe! @string.html_safe! @@ -416,4 +434,10 @@ class OutputSafetyTest < ActiveSupport::TestCase @other_string << @string assert @other_string.html_safe? end + + test "Concatting a fixnum to safe always yields safe" do + @string.html_safe! + @string.concat(13) + assert @string.html_safe? + end end |