Test 适配器,用于 Action Cable¶ ↑
测试适配器应仅用于测试。结合 ActionCable::TestHelper,它是测试您的 Rails 应用程序的绝佳工具。
要使用测试适配器,请在您的 config/cable.yml 文件中将 adapter 值设置为 test。
注意:Test 适配器扩展了 ActionCable::SubscriptionAdapter::Async 适配器,因此它也可以用于系统测试。
方法
- B
- C
实例公共方法
broadcast(channel, payload) 链接
来源: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 18 def broadcast(channel, payload) broadcasts(channel) << payload super end
broadcasts(channel) 链接
来源: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 23 def broadcasts(channel) channels_data[channel] ||= [] end
clear() 链接
来源: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 31 def clear @channels_data = nil end
clear_messages(channel) 链接
来源: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 27 def clear_messages(channel) channels_data[channel] = [] end