diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-04-22 12:27:25 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-04-22 12:37:48 +0900 |
commit | 87d6cb379d8cffd3f12b2dab6248ff3e8f830307 (patch) | |
tree | e619535bbb36b8c9bb7467bc492b1599fd632e9a /railties/test | |
parent | 0541a0d5481043a9c78371446389794944daf3f0 (diff) | |
download | rails-87d6cb379d8cffd3f12b2dab6248ff3e8f830307.tar.gz rails-87d6cb379d8cffd3f12b2dab6248ff3e8f830307.tar.bz2 rails-87d6cb379d8cffd3f12b2dab6248ff3e8f830307.zip |
Set to `form_with_generates_remote_forms` only when config is explicitly specified
Without this check, even if config is not specified, `ActionView::Helpers::FormHelper.form_with_generates_remote_forms`
always be set to nil and remote form not be generated.
Follow up to 128b804c6ce40fcbde744f294f8cb98654f6efec
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/configuration_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 32eab74190..07c6afed7f 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -725,6 +725,34 @@ module ApplicationTests assert_no_match(/data-remote/, last_response.body) end + test "form_with generates remote forms by default" do + app_file "app/models/post.rb", <<-RUBY + class Post + include ActiveModel::Model + attr_accessor :name + end + RUBY + + app_file "app/controllers/posts_controller.rb", <<-RUBY + class PostsController < ApplicationController + def index + render inline: "<%= begin; form_with(model: Post.new) {|f| f.text_field(:name)}; rescue => e; e.to_s; end %>" + end + end + RUBY + + add_to_config <<-RUBY + routes.prepend do + resources :posts + end + RUBY + + app "development" + + get "/posts" + assert_match(/data-remote/, last_response.body) + end + test "default method for update can be changed" do app_file "app/models/post.rb", <<-RUBY class Post |