aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_options_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template/form_options_helper_test.rb')
-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 6b8d62df62..606d454cb3 100644
--- a/actionpack/test/template/form_options_helper_test.rb
+++ b/actionpack/test/template/form_options_helper_test.rb
@@ -509,7 +509,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')
@@ -665,6 +665,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>"