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-1.0.3 spec/shared/protocol_msgbus_behaviour.rb
ably-1.0.2 spec/shared/protocol_msgbus_behaviour.rb
ably-1.0.1 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-1.0.0 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-1.0.0 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.8.15 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-0.8.15 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.9.3 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.9.2 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.9.1 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.9.0 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.8.14 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-0.8.14 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.8.13 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-0.8.13 spec/shared/protocol_msgbus_behaviour.rb
ably-0.8.12 spec/shared/protocol_msgbus_behaviour.rb
ably-0.8.11 spec/shared/protocol_msgbus_behaviour.rb
ably-0.8.10 spec/shared/protocol_msgbus_behaviour.rb
ably-rest-0.8.9 lib/submodules/ably-ruby/spec/shared/protocol_msgbus_behaviour.rb
ably-0.8.9 spec/shared/protocol_msgbus_behaviour.rb