Skip to content

Commit

Permalink
Merge pull request #41643 from etiennebarrie/engine-include_all_helpers
Browse files Browse the repository at this point in the history
Nudge engines to be compatible with include_all_helpers
  • Loading branch information
rafaelfranca committed Jun 8, 2021
2 parents 5adb6a9 + d5b8b66 commit dea7938
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Expand Up @@ -141,6 +141,13 @@ def test_dummy_config
if mountable?
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
end
if engine? && !api?
insert_into_file "#{dummy_path}/config/application.rb", indent(<<~RUBY, 4), after: /^\s*config\.load_defaults.*\n/
# For compatibility with applications that use this config
config.action_controller.include_all_helpers = false
RUBY
end
end

def test_dummy_webpacker_assets
Expand Down
28 changes: 28 additions & 0 deletions railties/test/generators/plugin_generator_test.rb
Expand Up @@ -591,6 +591,34 @@ def test_dummy_application_loads_plugin
assert_file "test/dummy/config/application.rb", /^require "bukkits"/
end

def test_dummy_application_sets_include_all_helpers_to_false_for_mountable
run_generator [destination_root, "--mountable"]

assert_file "test/dummy/config/application.rb", /^ config\.action_controller\.include_all_helpers = false$/
end

def test_dummy_application_sets_include_all_helpers_to_false_for_full
run_generator [destination_root, "--full"]

assert_file "test/dummy/config/application.rb", /include_all_helpers/
end

def test_dummy_application_does_not_set_include_all_helpers_for_regular
run_generator

assert_file "test/dummy/config/application.rb" do |content|
assert_no_match(/include_all_helpers/, content)
end
end

def test_dummy_application_does_not_set_include_all_helpers_for_api
run_generator [destination_root, "--mountable", "--api"]

assert_file "test/dummy/config/application.rb" do |content|
assert_no_match(/include_all_helpers/, content)
end
end

def test_dummy_application_uses_dynamic_rails_version_number
run_generator

Expand Down

0 comments on commit dea7938

Please sign in to comment.