Sha256: 016fecc4402cf98e96e3447bc641c667287e657d0cac91e85868d98a1eaf7d31

Contents?: true

Size: 738 Bytes

Versions: 7

Compression:

Stored size: 738 Bytes

Contents

require 'routemaster/jobs/cache_and_sweep'
require 'spec_helper'

RSpec.describe Routemaster::Jobs::CacheAndSweep do
  subject { described_class.new }

  context 'when there is an ResourceNotFound error' do
    before do
      expect_any_instance_of(Routemaster::Cache).to receive(:get).and_raise(Routemaster::Errors::ResourceNotFound.new(""))
    end

    it 'does not bubble up the error' do
      expect { subject.perform('url') }.to_not raise_error
    end
  end

  context 'when there is any other error' do
    before do
      expect_any_instance_of(Routemaster::Cache).to receive(:get).and_raise("boom")
    end

    it 'does bubble up the error' do
      expect { subject.perform('url') }.to raise_error("boom")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
routemaster-drain-2.5.0 spec/routemaster/jobs/cache_and_sweep_spec.rb
routemaster-drain-2.4.4 spec/routemaster/jobs/cache_and_sweep_spec.rb
routemaster-drain-2.4.3 spec/routemaster/jobs/cache_and_sweep_spec.rb
routemaster-drain-2.4.2 spec/routemaster/jobs/cache_and_sweep_spec.rb
routemaster-drain-2.4.1 spec/routemaster/jobs/cache_and_sweep_spec.rb
routemaster-drain-2.4.0 spec/routemaster/jobs/cache_and_sweep_spec.rb
routemaster-drain-2.3.0 spec/routemaster/jobs/cache_and_sweep_spec.rb