Sha256: ac36d033459680138510fa7374d35bf5edf32313b821217ff5482ea83363966b

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

require 'spec_helper'

describe Firehose::Broker do
  include EM::TestHelper

  let(:broker)  { Firehose::Broker.new }

  it "should unsubscibe consumers and remove them from the collection" do
    stats = nil

    em do
      broker.consumer('1').subscribe_to('/the-channel')
      broker.consumer('2').subscribe_to('/the-channel')
      broker.consumer('2').subscribe_to('/a-channel')

      em.add_timer(1) do
        stats = broker.stats
        broker.stop
        em.stop
      end
    end

    stats.should == {
      '1' => {'subscriptions' => ['/the-channel'] },
      '2' => {'subscriptions' => ['/the-channel', '/a-channel']}
    }

    broker.stats.should == {}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
firehose-0.0.16 spec/lib/broker_spec.rb