未验证 提交 dc06e40d 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #34003 from palkan/fix/cable-test-case-rails5-hack

Remove Rails 5.0 workaround from ActionCable::Channel::TestCase
......@@ -215,13 +215,9 @@ def stub_connection(identifiers = {})
# Subsribe to the channel under test. Optionally pass subscription parameters as a Hash.
def subscribe(params = {})
@connection ||= stub_connection
# NOTE: Rails < 5.0.1 calls subscribe_to_channel during #initialize.
# We have to stub before it
@subscription = self.class.channel_class.allocate
@subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)
@subscription.singleton_class.include(ChannelStub)
@subscription.send(:initialize, connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)
# Call subscribe_to_channel if it's public (Rails 5.0.1+)
@subscription.subscribe_to_channel if ActionCable.gem_version >= Gem::Version.new("5.0.1")
@subscription.subscribe_to_channel
@subscription
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册