Sha256: 1bb9f48dc80b854340357598301821acde7d6fc3595f3140176bce53f05d5ac4

Contents?: true

Size: 1.79 KB

Versions: 14

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

describe DispatchRider::Configuration do

  subject { described_class.new }

  describe "defaults" do
    example do
      expect(subject.handler_path).to match_regex(/\/app\/handlers/)
      expect(subject.error_handler).to eq DispatchRider::DefaultErrorHandler
      expect(subject.queue_kind).to eq :file_system
      expect(subject.queue_info).to eq(path: "tmp/dispatch-rider-queue")
      expect(subject.subscriber).to eq DispatchRider::Subscriber
    end
  end

  describe "#before" do
    example do
      expect(subject).to respond_to :before
    end
  end

  describe "#after" do
    example do
      expect(subject).to respond_to :after
    end
  end

  describe "#around" do
    example do
      expect(subject).to respond_to :around
    end
  end

  describe "#handlers" do
    before :each do
      subject.handler_path = "./spec/fixtures/handlers"
    end

    it "loads the files and converts their names to symbols" do
      expect(subject.handlers).to include(:test_handler, :another_test_handler)
    end
  end

  describe "#default_retry_timeout" do
    it "sets the default timeout" do
      subject.default_retry_timeout = 60
      expect(TestHandler.instance_methods).to include(:retry_timeout)
      #Need to do this so that all the other tests don't have this as default!
      DispatchRider::Handlers::Base.send(:remove_method, :retry_timeout)
    end
  end

  describe "#logger" do

    describe "default" do
      example { expect(subject.logger).to be_kind_of(Logger) }
    end

    example { expect(subject).to respond_to(:logger) }
  end

  describe "#logger=" do
    let(:new_logger) { double(:logger) }

    example { expect(subject).to respond_to(:logger=) }

    example do
      subject.logger = new_logger
      expect(subject.logger).to eq new_logger
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dispatch-rider-1.9.0 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.8.6 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.8.5 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.8.4 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.8.3 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.8.2 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.8.1 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.8.0 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.7.2 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.7.1 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.7.0 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.6.2 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.6.1 spec/lib/dispatch-rider/configuration_spec.rb
dispatch-rider-1.6.0 spec/lib/dispatch-rider/configuration_spec.rb