Sha256: b47d5468a665f19ffb105b9f94479902940eb3a06644b66a897d211a5e860925
Contents?: true
Size: 1007 Bytes
Versions: 17
Compression:
Stored size: 1007 Bytes
Contents
require 'unit_spec_helper' describe Rpush::Daemon::Dispatcher::Http do let(:app) { double } let(:delivery_class) { double } let(:notification) { double } let(:batch) { double } let(:http) { double } let(:queue_payload) { Rpush::Daemon::QueuePayload.new(batch, notification) } let(:dispatcher) { Rpush::Daemon::Dispatcher::Http.new(app, delivery_class) } before { Net::HTTP::Persistent.stub(new: http) } it 'constructs a new persistent connection' do Net::HTTP::Persistent.should_receive(:new) Rpush::Daemon::Dispatcher::Http.new(app, delivery_class) end describe 'dispatch' do it 'delivers the notification' do delivery = double delivery_class.should_receive(:new).with(app, http, notification, batch).and_return(delivery) delivery.should_receive(:perform) dispatcher.dispatch(queue_payload) end end describe 'cleanup' do it 'closes the connection' do http.should_receive(:shutdown) dispatcher.cleanup end end end
Version data entries
17 entries across 17 versions & 1 rubygems