提交 4c4dd06a 编写于 作者: J Jeremy Daer

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

don't remove `cable.js` when a channel is removed
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册