mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
don't remove cable.js
`cable.js` is required for other Channels.
This commit is contained in:
parent
39e087cbf5
commit
aa757d0c11
2 changed files with 15 additions and 1 deletions
|
@ -13,7 +13,9 @@ module Rails
|
|||
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 @@ class ChannelGeneratorTest < Rails::Generators::TestCase
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue