Sha256: 53567a3dd75ac9e5b8e064d32a29e664ffa6b9bb15ea425d867f729590d5bae7

Contents?: true

Size: 1009 Bytes

Versions: 5

Compression:

Stored size: 1009 Bytes

Contents

require 'spec_helper'

describe Listen do
  describe '.to' do
    it "initalizes listener" do
      expect(Listen::Listener).to receive(:new).with('/path')
      described_class.to('/path')
    end

    context 'when using :forward_to option' do
      it 'initializes TCP-listener in broadcast-mode' do
        expect(Listen::TCP::Listener).to receive(:new).with(4000, :broadcaster, '/path', {})
        described_class.to('/path', forward_to: 4000)
      end
    end

    it "sets stopping at false" do
      allow(Listen::Listener).to receive(:new)
      Listen.to('/path')
      expect(Listen.stopping).to be_false
    end
  end

  describe '.stop' do
    it "stops all listeners & Celluloid" do
      Listen.stop
      expect(Celluloid.internal_pool.running?).to be_false
    end
  end

  describe '.on' do
    it 'initializes TCP-listener in recipient-mode' do
      expect(Listen::TCP::Listener).to receive(:new).with(4000, :recipient, '/path')
      described_class.on(4000, '/path')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
listen-2.7.4 spec/lib/listen_spec.rb
listen-2.7.3 spec/lib/listen_spec.rb
listen-2.7.2 spec/lib/listen_spec.rb
listen-2.7.1 spec/lib/listen_spec.rb
listen-2.7.0 spec/lib/listen_spec.rb