Module: RSpec::SidekiqPro::Matchers

Defined in:
lib/rspec/sidekiq_pro/matchers.rb,
lib/rspec/sidekiq_pro/matchers/job_matcher.rb,
lib/rspec/sidekiq_pro/matchers/enqueue_sidekiq_jobs.rb,
lib/rspec/sidekiq_pro/matchers/have_enqueued_sidekiq_jobs.rb

Defined Under Namespace

Modules: JobMatcher Classes: EnqueueSidekiqJobs, HaveEnqueuedSidekiqJobs

Instance Method Summary collapse

Instance Method Details

#enqueue_sidekiq_job(worker_class) ⇒ Object Also known as: enqueue_sidekiq_jobs

Checks if a certain job was enqueued in a block.

expect { AwesomeWorker.perform_async }

.to enqueue_sidekiq_job(AwesomeWorker)

expect { AwesomeWorker.perform_async(42, ‘David’)

.to enqueue_sidekiq_job(AwesomeWorker).with(42, 'David')

expect { AwesomeWorker.perform_in(5.minutes) }

.to enqueue_sidekiq_job(AwesomeWorker).in(5.minutes)


37
38
39
# File 'lib/rspec/sidekiq_pro/matchers.rb', line 37

def enqueue_sidekiq_job(worker_class)
  EnqueueSidekiqJobs.new(worker_class)
end

#have_enqueued_sidekiq_jobObject Also known as: have_enqueued_sidekiq_jobs

Checks if a certain job was enqueued.

AwesomeWorker.perform_async expect(AwesomeWorker).to have_enqueued_sidekiq_job

AwesomeWorker.perform_async(42, ‘David’) expect(AwesomeWorker).to have_enqueued_sidekiq_job.with(42, ‘David’)

AwesomeWorker.perform_in(5.minutes) expect(AwesomeWorker).to have_enqueued_sidekiq_job.in(5.minutes)



20
21
22
# File 'lib/rspec/sidekiq_pro/matchers.rb', line 20

def have_enqueued_sidekiq_job
  HaveEnqueuedSidekiqJobs.new
end