Sha256: d9c7652f97df1ca78c11805792a4168f6839639cacf045a6c064532980129ffb

Contents?: true

Size: 1.12 KB

Versions: 82

Compression:

Stored size: 1.12 KB

Contents

shared_examples 'a protocol message bus' do
  describe '__protocol_msgbus__ PubSub', :api_private do
    let(:protocol_message) do
      Ably::Models::ProtocolMessage.new(
        action: 15,
        channel: 'channel',
        msg_serial: 0,
        messages: []
      )
    end

    specify 'supports valid ProtocolMessage messages' do
      received = 0
      msgbus.subscribe(:protocol_message) { received += 1 }
      expect { msgbus.publish(:protocol_message, protocol_message) }.to change { received }.to(1)
    end

    specify 'fail with unacceptable STATE event names' do
      expect { msgbus.subscribe(:invalid) }.to raise_error KeyError
      expect { msgbus.publish(:invalid) }.to raise_error KeyError
      expect { msgbus.unsubscribe(:invalid) }.to raise_error KeyError
    end
  end
end

shared_examples 'an incoming protocol message bus' do
  it_behaves_like 'a protocol message bus' do
    let(:msgbus) { subject.__incoming_protocol_msgbus__ }
  end
end

shared_examples 'an outgoing protocol message bus' do
  it_behaves_like 'a protocol message bus' do
    let(:msgbus) { subject.__outgoing_protocol_msgbus__ }
  end
end

Version data entries

82 entries across 82 versions & 2 rubygems

Version Path
ably-rest-1.2.7 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.2.7 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.2.6 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.2.6 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.2.4 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.2.4 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.2.3 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.2.3 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.2.2 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.2.2 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.2.1 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.2.1 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.2.0 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.2.0 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.1.8 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.1.8 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.1.7 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.1.7 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.1.6 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.1.6 spec/shared/protocol_msgbus_behaviour.rb