Sha256: 71aa41e05bbd24de9d220eda14feb5c414b0c621f275f06a611d13a7f91492dc

Contents?: true

Size: 1.19 KB

Versions: 47

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

# require girl_friday in the test instead in the implementation
# just to let the user decide to load it or not
require 'girl_friday'
require 'rollbar/delay/girl_friday'

describe Rollbar::Delay::GirlFriday do
  before do
    queue_class = ::GirlFriday::WorkQueue.immediate!
    allow(::Rollbar::Delay::GirlFriday).to receive(:queue_class).and_return(queue_class)
  end

  describe '.call' do
    let(:payload) do
      { :key => 'value' }
    end

    it 'push the payload into the queue' do
      expect(Rollbar).to receive(:process_from_async_handler).with(payload)

      described_class.call(payload)
    end

    context 'with exceptions processing payload' do
      let(:exception) { Exception.new }

      before do
        expect(Rollbar).to receive(:process_from_async_handler).with(payload).and_raise(exception)
      end

      it 'raises an exception cause we are using immediate queue' do
        # This will not happen with a norma work queue cause this:
        # https://github.com/mperham/girl_friday/blob/master/lib/girl_friday/work_queue.rb#L90-L106
        expect do
          described_class.call(payload)
        end.to raise_error(exception)
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
rollbar-2.18.2 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.18.0 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.17.0 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.16.4 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.16.3 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.16.2 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.16.0 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.15.6 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.15.5 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.15.4 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.15.3 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.15.2 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.15.1 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.15.0 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.14.1 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.14.0 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.13.3 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.13.2 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.13.1 spec/rollbar/delay/girl_friday_spec.rb
rollbar-2.13.0 spec/rollbar/delay/girl_friday_spec.rb