diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-10-25 07:58:05 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-10-25 07:58:05 +0900 |
commit | 5b54a904101c48aac9467df1f060b83c67bee832 (patch) | |
tree | faef6228c0d680011a609f79c62e49c29717388f /railties | |
parent | a0d0648efb5faa5d8d94a090e8b6ff498a7a9475 (diff) | |
download | rails-5b54a904101c48aac9467df1f060b83c67bee832.tar.gz rails-5b54a904101c48aac9467df1f060b83c67bee832.tar.bz2 rails-5b54a904101c48aac9467df1f060b83c67bee832.zip |
remove assets config from `new_framework_defaults` if `--skip-sprockets` is true
If `sprockets` is not loaded, `Rails.application.config.assets` is not defined.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt | 2 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt index 5ad18cc5ad..3ad3eba98a 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt @@ -32,7 +32,9 @@ ActiveSupport.halt_callback_chains_on_return_false = <%= options[:update] ? true # Configure SSL options to enable HSTS with subdomains. Previous versions had false. Rails.application.config.ssl_options = { hsts: { subdomains: true } } <%- end -%> +<%- unless options[:skip_sprockets] -%> # Unknown asset fallback will return the path passed in when the given # asset is not present in the asset pipeline. Rails.application.config.assets.unknown_asset_fallback = <%= options[:update] ? true : false %> +<%- end -%> diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 830e49a1b5..9299b9ebea 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -412,6 +412,9 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_no_match(/config\.assets\.js_compressor = :uglifier/, content) assert_no_match(/config\.assets\.css_compressor = :sass/, content) end + assert_file "config/initializers/new_framework_defaults.rb" do |content| + assert_no_match(/unknown_asset_fallback/, content) + end end def test_generator_if_skip_action_cable_is_given |