From c074343cffceaa8e5fc97db1f48e58dd8aff4723 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 4 Feb 2016 20:04:13 +0530 Subject: [PATCH] - app generate option --skip-sprockets leaves jquery-rails gem, which relies on sprockets environment - Remove jquery-rails if --skip-sprockets is true Fixes #23431 --- railties/lib/rails/generators/app_base.rb | 2 +- railties/test/generators/app_generator_test.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 961efd05e3968..9b1e16a7a372f 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -317,7 +317,7 @@ def coffee_gemfile_entry end def javascript_gemfile_entry - if options[:skip_javascript] + if options[:skip_javascript] || options[:skip_sprockets] [] else gems = [coffee_gemfile_entry, javascript_runtime_gemfile_entry] diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index b954738ff2784..f483a0bcbda24 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -385,9 +385,10 @@ def test_generator_if_skip_sprockets_is_given assert_match(/#\s+require\s+["']sprockets\/railtie["']/, content) end assert_file "Gemfile" do |content| + assert_no_match(/jquery-rails/, content) assert_no_match(/sass-rails/, content) assert_no_match(/uglifier/, content) - assert_match(/coffee-rails/, content) + assert_no_match(/coffee-rails/, content) end assert_file "config/environments/development.rb" do |content| assert_no_match(/config\.assets\.debug = true/, content)