aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2016-12-15 01:40:22 -0500
committerGeorge Claghorn <george.claghorn@gmail.com>2016-12-15 02:10:10 -0500
commit5b217c3a7f294a74d4680e71ef64047432b9ffc2 (patch)
treefd17fa7bb73e8bd5c8b2e7bdb4fa854b9717778d /actionview/test/template/form_helper
parent1f0fe334f577479ad524cb990bef4454585857c0 (diff)
downloadrails-5b217c3a7f294a74d4680e71ef64047432b9ffc2.tar.gz
rails-5b217c3a7f294a74d4680e71ef64047432b9ffc2.tar.bz2
rails-5b217c3a7f294a74d4680e71ef64047432b9ffc2.zip
Avoid invalid attribute on local forms generated by `form_with`
Fixes that the following ERB template would result in invalid HTML output: <%= form_with model: Post.new, local: true do |form| %> <% end %> Specifically, the resulting form tag would have a spurious `remote` attribute: <form remote="false" ...>
Diffstat (limited to 'actionview/test/template/form_helper')
-rw-r--r--actionview/test/template/form_helper/form_with_test.rb10
1 files changed, 10 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 4efc93ca08..c078b47e14 100644
--- a/actionview/test/template/form_helper/form_with_test.rb
+++ b/actionview/test/template/form_helper/form_with_test.rb
@@ -116,6 +116,16 @@ class FormWithActsLikeFormTagTest < FormWithTest
assert_dom_equal expected, output_buffer
end
+
+ def test_form_with_with_block_in_erb_and_local_true
+ output_buffer = render_erb("<%= form_with(url: 'http://www.example.com', local: true) do %>Hello world!<% end %>")
+
+ expected = whole_form("http://www.example.com", local: true) do
+ "Hello world!"
+ end
+
+ assert_dom_equal expected, output_buffer
+ end
end
class FormWithActsLikeFormForTest < FormWithTest