Class: GraphQL::Testing::MockActionCable::MockStream Private
- Inherits:
-
Object
- Object
- GraphQL::Testing::MockActionCable::MockStream
- 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
-
#add_mock_channel(channel, handler) ⇒ Object
private
-
#initialize ⇒ MockStream
constructor
private
A new instance of MockStream.
-
#mock_broadcast(message) ⇒ Object
private
Constructor Details
#initialize ⇒ MockStream
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() @mock_channels.each do |channel, handler| handler && handler.call() end end |