diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-02-23 23:03:50 +0200 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-02-23 23:05:20 +0200 |
commit | ab63420233e124a6f04b76d5bc848d11ba28689c (patch) | |
tree | 7231432b0f6d910e637edc3d66291afdd24434e8 | |
parent | 5ecbeda0e225e4961977b5c516088cf12d92319f (diff) | |
download | rails-ab63420233e124a6f04b76d5bc848d11ba28689c.tar.gz rails-ab63420233e124a6f04b76d5bc848d11ba28689c.tar.bz2 rails-ab63420233e124a6f04b76d5bc848d11ba28689c.zip |
Improve generated file `app/assets/javascripts/application.js` of plugin
Add `//= require rails-ujs`
Closes #32094
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt | 1 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt b/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt index f3d80c87f5..51049826bf 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt @@ -10,6 +10,7 @@ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // +//= require rails-ujs <% unless skip_active_storage? -%> //= require activestorage <% end -%> diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index fba090c004..28ac3611b7 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -217,7 +217,11 @@ class PluginGeneratorTest < Rails::Generators::TestCase def test_javascripts_generation run_generator [destination_root, "--mountable"] - assert_file "app/assets/javascripts/bukkits/application.js" + assert_file "app/assets/javascripts/bukkits/application.js" do |content| + assert_match "//= require rails-ujs", content + assert_match "//= require activestorage", content + assert_match "//= require_tree .", content + end assert_file "app/views/layouts/bukkits/application.html.erb" do |content| assert_match "javascript_include_tag", content end |