Sha256: 3d305764a2cccae06231e70551fee7a6cedfe1d398b553698f83913975304fb3

Contents?: true

Size: 567 Bytes

Versions: 3

Compression:

Stored size: 567 Bytes

Contents

module ActiveJob
  module QueueAdapters
    class TestAdapter
      alias original_enqueue enqueue
      alias original_enqueue_at enqueue_at

      def fixup_last_job(job)
        list = perform_enqueued_jobs ? performed_jobs : enqueued_jobs
        list.last[:id] = job.job_id
      end

      def enqueue(job)
        result = original_enqueue(job)
        fixup_last_job(job)
        result
      end

      def enqueue_at(job, timestamp)
        result = original_enqueue_at(job, timestamp)
        fixup_last_job(job)
        result
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activejob-cancel-0.3.2 lib/active_job/cancel/queue_adapters/test_adapter/rails_4.rb
activejob-cancel-0.3.1 lib/active_job/cancel/queue_adapters/test_adapter/rails_4.rb
activejob-cancel-0.3.0 lib/active_job/cancel/queue_adapters/test_adapter/rails_4.rb