Sha256: 3a6da987acb4d1d286f2f4aea07f4e5d1d7385bac78f79c2366a67f20bc0b6fd
Contents?: true
Size: 1.48 KB
Versions: 42
Compression:
Stored size: 1.48 KB
Contents
require 'unit_spec_helper' describe Rpush::Daemon::DispatcherLoop do def run_dispatcher_loop dispatcher_loop.start dispatcher_loop.stop end let(:notification) { double } let(:batch) { double(notification_processed: nil) } let(:queue) { Queue.new } let(:dispatcher) { double(dispatch: nil, cleanup: nil) } let(:dispatcher_loop) { Rpush::Daemon::DispatcherLoop.new(queue, dispatcher) } let(:store) { double(Rpush::Daemon::Store::ActiveRecord, release_connection: nil) } before do allow(Rpush::Daemon).to receive_messages(store: store) queue.push([notification, batch]) end it 'logs errors' do logger = double allow(Rpush).to receive_messages(logger: logger) error = StandardError.new allow(dispatcher).to receive(:dispatch).and_raise(error) expect(Rpush.logger).to receive(:error).with(error) run_dispatcher_loop end it 'reflects an exception' do allow(Rpush).to receive_messages(logger: double(error: nil)) error = StandardError.new allow(dispatcher).to receive(:dispatch).and_raise(error) expect(dispatcher_loop).to receive(:reflect).with(:error, error) run_dispatcher_loop end describe 'stop' do before do queue.clear end it 'instructs the dispatcher to cleanup' do expect(dispatcher).to receive(:cleanup) run_dispatcher_loop end it 'releases the store connection' do expect(Rpush::Daemon.store).to receive(:release_connection) run_dispatcher_loop end end end
Version data entries
42 entries across 42 versions & 2 rubygems
Version | Path |
---|---|
rpush-2.3.2-java | spec/unit/daemon/dispatcher_loop_spec.rb |
rpush-2.3.2 | spec/unit/daemon/dispatcher_loop_spec.rb |