don't remove cable.js

`cable.js` is required for other Channels.
This commit is contained in:
yuuji.yaginuma 2016-04-16 15:19:41 +09:00
parent 39e087cbf5
commit aa757d0c11
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]
template "assets/cable.js", "app/assets/javascripts/cable.js"
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