Skip to content

Commit

Permalink
Ensure Action Cable files are removed when skip_action_cable is set.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeyb committed Dec 21, 2015
1 parent 914a45b commit 96093e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions railties/lib/rails/generators/rails/app/app_generator.rb
Expand Up @@ -313,6 +313,14 @@ def delete_active_record_initializers_skipping_active_record
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'
Expand Down
3 changes: 3 additions & 0 deletions railties/test/generators/app_generator_test.rb
Expand Up @@ -379,6 +379,9 @@ def test_generator_if_skip_sprockets_is_given
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
Expand Down

0 comments on commit 96093e3

Please sign in to comment.