aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-04-22 12:27:25 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-04-22 12:37:48 +0900
commit87d6cb379d8cffd3f12b2dab6248ff3e8f830307 (patch)
treee619535bbb36b8c9bb7467bc492b1599fd632e9a /railties/test
parent0541a0d5481043a9c78371446389794944daf3f0 (diff)
downloadrails-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.rb28
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