Merge pull request #24574 from y-yagi/donot_remove_cable.js

don't remove `cable.js` when a channel is removed
This commit is contained in:
Jeremy Daer 2016-04-16 16:24:43 -07:00
commit 4c4dd06aa6
2 changed files with 15 additions and 1 deletions

@ -13,7 +13,9 @@ def create_channel_file
template "channel.rb", File.join('app/channels', class_path, "#{file_name}_channel.rb")
if options[:assets]
if self.behavior == :invoke
template "assets/cable.js", "app/assets/javascripts/cable.js"
end
template "assets/channel.coffee", File.join('app/assets/javascripts/channels', class_path, "#{file_name}.coffee")
end

@ -46,4 +46,16 @@ def test_cable_js_is_created_if_not_present_already
assert_file "app/assets/javascripts/cable.js"
end
def test_channel_on_revoke
run_generator ['chat']
run_generator ['chat'], behavior: :revoke
assert_no_file "app/channels/chat_channel.rb"
assert_no_file "app/assets/javascripts/channels/chat.coffee"
assert_file "app/channels/application_cable/channel.rb"
assert_file "app/channels/application_cable/connection.rb"
assert_file "app/assets/javascripts/cable.js"
end
end