aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-01-23 08:21:41 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-01-23 08:21:41 +0100
commit39ea2b09edcf8179fe69808424d325612194d4cb (patch)
treee02132389bf2ee76e67af2e408d699de7e36b5b6 /railties
parent4fdc56d5788349522fc6d43bbab14811a9f1f29e (diff)
parent578af21a4156ff29b4c28936324c54bb1eb83d54 (diff)
downloadrails-39ea2b09edcf8179fe69808424d325612194d4cb.tar.gz
rails-39ea2b09edcf8179fe69808424d325612194d4cb.tar.bz2
rails-39ea2b09edcf8179fe69808424d325612194d4cb.zip
Merge pull request #23206 from joyvuu-dave/action_cable_api_fix
prevent --skip-action-cable from erroring when --api option is used
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb2
-rw-r--r--railties/test/generators/app_generator_test.rb12
2 files changed, 13 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 3d689ff37e..a4758857f2 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -318,7 +318,7 @@ module Rails
remove_file 'config/cable.yml'
remove_file 'app/assets/javascripts/cable.coffee'
remove_dir 'app/channels'
- gsub_file 'app/views/layouts/application.html.erb', /action_cable_meta_tag/, ''
+ gsub_file 'app/views/layouts/application.html.erb', /action_cable_meta_tag/, '' unless options[:api]
end
end
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 5b62b500e5..136bdd1694 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -405,6 +405,18 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
+ def test_generator_if_skip_action_cable_is_given_for_an_api_app
+ run_generator [destination_root, "--skip-action-cable", "--api"]
+ assert_file "config/application.rb", /#\s+require\s+["']action_cable\/engine["']/
+ assert_no_file "config/cable.yml"
+ assert_no_file "app/assets/javascripts/cable.coffee"
+ assert_no_file "app/channels"
+ assert_file "Gemfile" do |content|
+ assert_no_match(/em-hiredis/, content)
+ assert_no_match(/redis/, content)
+ end
+ end
+
def test_action_cable_redis_gems
run_generator
assert_gem 'em-hiredis'