aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorYehuda Katz <wycats@Yehuda-Katz.local>2010-01-31 19:17:42 -0800
committerYehuda Katz <wycats@Yehuda-Katz.local>2010-01-31 19:39:13 -0800
commit4cbb9db0a5ff65b0a626a5b043331abefd89e717 (patch)
treea112ce55f5521ff31abf0e4357afcc170fc0a143 /actionpack/test/controller
parent1c83fd2eff3fd174e1aba0512aa2dd8ecdadb2c7 (diff)
downloadrails-4cbb9db0a5ff65b0a626a5b043331abefd89e717.tar.gz
rails-4cbb9db0a5ff65b0a626a5b043331abefd89e717.tar.bz2
rails-4cbb9db0a5ff65b0a626a5b043331abefd89e717.zip
For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).
* Additionally, instead of doing concat("</form>".html_safe), you can do safe_concat("</form>"), which will skip both the flag set, and the flag check. * For the first pass, I converted virtually all #html_safe!s to #html_safe, and the tests pass. A further optimization would be to try to use #safe_concat as much as possible, reducing the performance impact if we know up front that a String is safe.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/caching_test.rb4
-rw-r--r--actionpack/test/controller/output_escaping_test.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index 8a13d1e5f1..de92fc56fd 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -611,7 +611,7 @@ class FragmentCachingTest < ActionController::TestCase
@store.write('views/expensive', 'fragment content')
fragment_computed = false
- buffer = 'generated till now -> '
+ buffer = 'generated till now -> '.html_safe
@controller.fragment_for(buffer, 'expensive') { fragment_computed = true }
assert fragment_computed
@@ -622,7 +622,7 @@ class FragmentCachingTest < ActionController::TestCase
@store.write('views/expensive', 'fragment content')
fragment_computed = false
- buffer = 'generated till now -> '
+ buffer = 'generated till now -> '.html_safe
@controller.fragment_for(buffer, 'expensive') { fragment_computed = true }
assert !fragment_computed
diff --git a/actionpack/test/controller/output_escaping_test.rb b/actionpack/test/controller/output_escaping_test.rb
index 7332f3f1e3..43a8c05cda 100644
--- a/actionpack/test/controller/output_escaping_test.rb
+++ b/actionpack/test/controller/output_escaping_test.rb
@@ -13,7 +13,7 @@ class OutputEscapingTest < ActiveSupport::TestCase
test "escapeHTML shouldn't touch explicitly safe strings" do
# TODO this seems easier to compose and reason about, but
# this should be verified
- assert_equal "<", ERB::Util.h("<".html_safe!)
+ assert_equal "<", ERB::Util.h("<".html_safe)
end
end