aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib
diff options
context:
space:
mode:
authorVladimir Dementyev <dementiev.vm@gmail.com>2018-09-27 11:13:32 -0400
committerVladimir Dementyev <dementiev.vm@gmail.com>2018-09-27 11:17:52 -0400
commite229346c9e53b119b82eec33411f1152d6a3e075 (patch)
tree8876de56f50f14b2c3e10671708a43c5b59c025d /actioncable/lib
parent1930d22936c3bfb883dd4b46173bb902db17bb50 (diff)
downloadrails-e229346c9e53b119b82eec33411f1152d6a3e075.tar.gz
rails-e229346c9e53b119b82eec33411f1152d6a3e075.tar.bz2
rails-e229346c9e53b119b82eec33411f1152d6a3e075.zip
Remove Rails 5.0 workaround from ActionCable::Channel::TestCase
The hack was merged from action-cable-testing gem by mistake. We don't need it in Rails 6. (cherry picked from commit 92030ec4b4309835ed0e792229984a1f0a044cef)
Diffstat (limited to 'actioncable/lib')
-rw-r--r--actioncable/lib/action_cable/channel/test_case.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/actioncable/lib/action_cable/channel/test_case.rb b/actioncable/lib/action_cable/channel/test_case.rb
index 88d7c7092b..a26051d687 100644
--- a/actioncable/lib/action_cable/channel/test_case.rb
+++ b/actioncable/lib/action_cable/channel/test_case.rb
@@ -215,13 +215,9 @@ module ActionCable
# 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