Sha256: 2d548bdf4ddce709fef9fcd80cc75c29f917a0c2021f5ec2994db90c9f09d930

Contents?: true

Size: 776 Bytes

Versions: 7

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true

# This file contains patches to Action Cable testing modules

# Trigger autoload (if constant is defined)
begin
  ActionCable::Channel::TestCase # rubocop:disable Lint/Void
  ActionCable::Connection::TestCase # rubocop:disable Lint/Void
rescue NameError
  return
end

ActionCable::Channel::ChannelStub.prepend(Module.new do
  def subscribe_to_channel
    # allocate @streams
    streams
    handle_subscribe
  end
end)

ActionCable::Channel::ConnectionStub.prepend(Module.new do
  def socket
    @socket ||= AnyCable::Socket.new(env: {})
  end

  alias_method :anycable_socket, :socket
end)

ActionCable::Connection::TestConnection.prepend(Module.new do
  def initialize(request)
    @request = request
    @cached_ids = {}
    super
  end
end)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
anycable-rails-1.0.4 lib/anycable/rails/actioncable/testing.rb
anycable-rails-1.0.3 lib/anycable/rails/actioncable/testing.rb
anycable-rails-1.0.2 lib/anycable/rails/actioncable/testing.rb
anycable-rails-1.0.1 lib/anycable/rails/actioncable/testing.rb
anycable-rails-1.0.0 lib/anycable/rails/actioncable/testing.rb
anycable-rails-1.0.0.rc4 lib/anycable/rails/actioncable/testing.rb
anycable-rails-1.0.0.rc3 lib/anycable/rails/actioncable/testing.rb