aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-01 09:51:51 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-01 09:51:51 -0800
commitc2897901de4266e5c02da6cc5a9348bfde13552e (patch)
tree6efe811c1c6e074fcac0daae63b9d9bf7634e995 /actionpack/test/template
parent5bb5780f7b2015f3f948f39e0151198591757056 (diff)
parent01b470f526922ad3fc5562a237d11d45347befa9 (diff)
downloadrails-c2897901de4266e5c02da6cc5a9348bfde13552e.tar.gz
rails-c2897901de4266e5c02da6cc5a9348bfde13552e.tar.bz2
rails-c2897901de4266e5c02da6cc5a9348bfde13552e.zip
Merge branch '3-2-2' into 3-2-stable
* 3-2-2: bumping to 3.2.2 Ensure [] respects the status of the buffer. Merge pull request #4834 from sskirby/fix_usage_of_psql_in_db_test_prepare Merge pull request #5084 from johndouthat/patch-1 updating RAILS_VERSION delete vulnerable AS::SafeBuffer#[] use AS::SafeBuffer#clone_empty for flushing the output_buffer add AS::SafeBuffer#clone_empty fix output safety issue with select options
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/form_options_helper_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb
index 62ab208c2e..5b19bcf0f9 100644
--- a/actionpack/test/template/form_options_helper_test.rb
+++ b/actionpack/test/template/form_options_helper_test.rb
@@ -495,7 +495,7 @@ class FormOptionsHelperTest < ActionView::TestCase
def test_select_under_fields_for_with_string_and_given_prompt
@post = Post.new
- options = "<option value=\"abe\">abe</option><option value=\"mus\">mus</option><option value=\"hest\">hest</option>"
+ options = "<option value=\"abe\">abe</option><option value=\"mus\">mus</option><option value=\"hest\">hest</option>".html_safe
output_buffer = fields_for :post, @post do |f|
concat f.select(:category, options, :prompt => 'The prompt')
@@ -651,6 +651,13 @@ class FormOptionsHelperTest < ActionView::TestCase
)
end
+ def test_select_escapes_options
+ assert_dom_equal(
+ '<select id="post_title" name="post[title]">&lt;script&gt;alert(1)&lt;/script&gt;</select>',
+ select('post', 'title', '<script>alert(1)</script>')
+ )
+ end
+
def test_select_with_selected_nil
@post = Post.new
@post.category = "<mus>"