Sha256: b50c730ce6c8456b46f10323a66d51cabafc51d1052f772193d029e1f5dad53c

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

require 'spec_helper'

RSpec.describe 'ActiveJob routines' do
  context 'default configuration' do
    class LaterRoutine
      lev_routine active_job_queue: :something_else

      protected
      def exec; end
    end

    it 'can perform routines later' do
      expect {
        LaterRoutine.perform_later
      }.to change { ActiveJob::Base.queue_adapter.enqueued_jobs.count }.by(1)
    end

    it 'can have the default queue overridden' do
      ActiveJob::Base.queue_adapter.enqueued_jobs.clear

      LaterRoutine.perform_later

      queue_name = ActiveJob::Base.queue_adapter.enqueued_jobs.first[:queue]

      expect(queue_name).to eq('something_else')
    end

    it 'stores all the UUIDs of queued jobs' do
      Lev.configuration.job_store.clear

      job_id1 = LaterRoutine.perform_later

      expect(Lev::BackgroundJob.send(:job_ids)).to eq([job_id1])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lev-5.0.0 spec/active_job_routines_spec.rb