Sha256: 8a94ea0aa964ec234f0885d4ebcd980a9cdca119da5267e7340513e7d4ee739d

Contents?: true

Size: 946 Bytes

Versions: 4

Compression:

Stored size: 946 Bytes

Contents

require 'proletariat/publisher'

module Proletariat
  describe Publisher do
    let(:connection) { double.as_null_object }
    let(:exchange_name) { 'great-exchange' }
    let(:logger) { double }

    before do
      allow(Proletariat).to receive(:connection).and_return(connection)
      allow(Proletariat).to receive(:exchange_name).and_return(exchange_name)
      allow(Proletariat).to receive(:logger).and_return(logger)
    end

    describe '#started' do
      it 'should log status' do
        expect(logger).to receive(:info).with /online/
        Publisher.new.started
      end
    end

    describe '#stopped' do
      it 'should log status' do
        expect(logger).to receive(:info).with /offline/
        Publisher.new.stopped
      end
    end

    describe '#stopping' do
      it 'should log status' do
        expect(logger).to receive(:info).with /graceful shutdown/
        Publisher.new.stopping
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proletariat-0.0.6 spec/lib/publisher_spec.rb
proletariat-0.0.5 spec/lib/publisher_spec.rb
proletariat-0.0.4 spec/lib/publisher_spec.rb
proletariat-0.0.3 spec/lib/publisher_spec.rb