1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ensure Action Cable files are removed when skip_action_cable is set.

The Action Cable generators creates four files which need to be removed
if `skip_action_cable` is set.

1. `app/assets/javascripts/cable.coffee`
2. `app/channels/application_cable/channel.rb`
3. `app/channels/application_cable/connection.rb`
4. `config/redis/cable.yml`

Fixes #22669.
This commit is contained in:
Jey Balachandran 2015-12-18 22:32:06 -05:00
parent 914a45b5fe
commit 96093e3cf7
2 changed files with 11 additions and 0 deletions

View file

@ -313,6 +313,14 @@ module Rails
end
end
def delete_action_cable_files_skipping_action_cable
if options[:skip_action_cable]
remove_file 'config/redis/cable.yml'
remove_file 'app/assets/javascripts/cable.coffee'
remove_dir 'app/channels'
end
end
def delete_non_api_initializers_if_api_option
if options[:api]
remove_file 'config/initializers/session_store.rb'

View file

@ -379,6 +379,9 @@ class AppGeneratorTest < Rails::Generators::TestCase
def test_generator_if_skip_action_cable_is_given
run_generator [destination_root, "--skip-action-cable"]
assert_file "config/application.rb", /#\s+require\s+["']action_cable\/engine["']/
assert_no_file "config/redis/cable.yml"
assert_no_file "app/assets/javascripts/cable.coffee"
assert_no_file "app/channels"
end
def test_inclusion_of_javascript_runtime