Class: GraphQL::Testing::MockActionCable::MockStream Private

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/testing/mock_action_cable.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Used by mock code

Instance Method Summary collapse

Constructor Details

#initializeMockStream

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MockStream.



60
61
62
# File 'lib/graphql/testing/mock_action_cable.rb', line 60

def initialize
  @mock_channels = {}
end

Instance Method Details

#add_mock_channel(channel, handler) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



64
65
66
# File 'lib/graphql/testing/mock_action_cable.rb', line 64

def add_mock_channel(channel, handler)
  @mock_channels[channel] = handler
end

#mock_broadcast(message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



68
69
70
71
72
# File 'lib/graphql/testing/mock_action_cable.rb', line 68

def mock_broadcast(message)
  @mock_channels.each do |channel, handler|
    handler && handler.call(message)
  end
end