aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper
diff options
context:
space:
mode:
authorYurii Cherniavskyi <ych@devlab21.com>2018-07-20 23:21:02 +0300
committerYurii Cherniavskyi <ych@devlab21.com>2018-07-20 23:21:02 +0300
commitd4a4a6f11814649bf3c628492ff7ac45a6d2b610 (patch)
tree0ae9fece596914d957f517f49d1bdd2fe68b342b /actionview/test/template/form_helper
parent7b3ead3b26682ee331e0e67eb4e3962742f9aa5e (diff)
downloadrails-d4a4a6f11814649bf3c628492ff7ac45a6d2b610.tar.gz
rails-d4a4a6f11814649bf3c628492ff7ac45a6d2b610.tar.bz2
rails-d4a4a6f11814649bf3c628492ff7ac45a6d2b610.zip
Fix leaking special form_with attributes into html attributes
Special form_with attributes `skip_default_ids` and `allow_method_names_outside_object` attributes are leaking into html attributes of option select tag helpers.
Diffstat (limited to 'actionview/test/template/form_helper')
-rw-r--r--actionview/test/template/form_helper/form_with_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb
index ed1683bad2..f07e494ee3 100644
--- a/actionview/test/template/form_helper/form_with_test.rb
+++ b/actionview/test/template/form_helper/form_with_test.rb
@@ -464,6 +464,23 @@ class FormWithActsLikeFormForTest < FormWithTest
end
end
+ def test_form_with_with_collection_select
+ post = Post.new
+ def post.active; false; end
+ form_with(model: post) do |f|
+ concat f.collection_select(:active, [true, false], :to_s, :to_s)
+ end
+
+ expected = whole_form("/posts") do
+ "<select name='post[active]' id='post_active'>" \
+ "<option value='true'>true</option>\n" \
+ "<option selected='selected' value='false'>false</option>" \
+ "</select>"
+ end
+
+ assert_dom_equal expected, output_buffer
+ end
+
def test_form_with_with_collection_radio_buttons
post = Post.new
def post.active; false; end