Sha256: 09e6dcf29c927b5d1a5084033d492918c7c8711e7ca963664dbccd50d42724f5

Contents?: true

Size: 842 Bytes

Versions: 8

Compression:

Stored size: 842 Bytes

Contents

require 'sidekiq_unique_jobs/testing/sidekiq_overrides'

module SidekiqUniqueJobs
  module Client
    class Middleware
      alias_method :call_real, :call
      def call(worker_class, item, queue, redis_pool = nil)
        worker_class = SidekiqUniqueJobs.worker_class_constantize(worker_class)

        if Sidekiq::Testing.inline?
          _server.call(worker_class.new, item, queue, redis_pool) do
            call_real(worker_class, item, queue, redis_pool) do
              yield
            end
          end
        else
          call_real(worker_class, item, queue, redis_pool) do
            yield
          end
        end
      end

      def _server
        SidekiqUniqueJobs::Server::Middleware.new
      end
    end
  end

  class Testing
    def mocking!
      require 'sidekiq_unique_jobs/testing/mocking'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-4.0.13 lib/sidekiq_unique_jobs/testing.rb
sidekiq-unique-jobs-4.0.12 lib/sidekiq_unique_jobs/testing.rb
sidekiq-unique-jobs-4.0.11 lib/sidekiq_unique_jobs/testing.rb
sidekiq-unique-jobs-4.0.10 lib/sidekiq_unique_jobs/testing.rb
sidekiq-unique-jobs-4.0.9 lib/sidekiq_unique_jobs/testing.rb
sidekiq-unique-jobs-4.0.8 lib/sidekiq_unique_jobs/testing.rb
sidekiq-unique-jobs-4.0.7 lib/sidekiq_unique_jobs/testing.rb
sidekiq-unique-jobs-4.0.0 lib/sidekiq_unique_jobs/testing.rb