Sha256: 507896a12c6c3a4af78b2249bc6d6fd38968d4a95044100e4ce70f115d952e01

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module Que
  module Testing
    class JobParams < Struct.new(:queue, :priority, :run_at, :job_class, :args)
    end

    class Adapter < Que::Adapters::Base
      def checkout(&block)
      end

      def execute(command, params = [])
        return [] unless command == :insert_job

        job = JobParams.new(*params)
        klass = class_for(job.job_class)
        jobs[klass] << job
        params
      end

      def wake_worker_after_commit
        false
      end

      def class_for(str)
        str.split('::').reduce(Object, &:const_get)
      end

      def jobs
        @jobs ||= Hash.new { |h,k| h[k] = [] }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
que-testing-0.2.0 lib/que/testing/adapter.rb