Sha256: 5905d7e9b100690a0c3ae9b77cbabf907be39d3b157f5ea0c5d55838210a2b07

Contents?: true

Size: 763 Bytes

Versions: 15

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'

describe PerfectQueue::Application::Dispatch do
  describe '.new' do
    before do
      router = Application::Dispatch.router
      handler = double('handler')
      allow(handler).to receive(:new).and_return(nil)
      router.add(/\Afoo\z/, handler, nil)
    end
    it 'returns a PerfectQueue::Application::Dispatch' do
      task = double('task', type: 'foo')
      dispatch = Application::Dispatch.new(task)
      expect(dispatch).to be_an_instance_of(Application::Dispatch)
    end
    it 'raises RuntimeError if the task type doesn\'t match' do
      task = double('task', type: 'bar')
      expect(task).to receive(:retry!).exactly(:once)
      expect{Application::Dispatch.new(task)}.to raise_error(RuntimeError)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
perfectqueue-0.8.54 spec/application/dispatch_spec.rb
perfectqueue-0.10.1 spec/application/dispatch_spec.rb
perfectqueue-0.8.53 spec/application/dispatch_spec.rb
perfectqueue-0.8.52 spec/application/dispatch_spec.rb
perfectqueue-0.10.0 spec/application/dispatch_spec.rb
perfectqueue-0.8.51 spec/application/dispatch_spec.rb
perfectqueue-0.8.50 spec/application/dispatch_spec.rb
perfectqueue-0.9.2 spec/application/dispatch_spec.rb
perfectqueue-0.9.1 spec/application/dispatch_spec.rb
perfectqueue-0.9.0 spec/application/dispatch_spec.rb
perfectqueue-0.8.49 spec/application/dispatch_spec.rb
perfectqueue-0.8.48 spec/application/dispatch_spec.rb
perfectqueue-0.8.47 spec/application/dispatch_spec.rb
perfectqueue-0.8.46 spec/application/dispatch_spec.rb
perfectqueue-0.8.45 spec/application/dispatch_spec.rb