Class: RSpec::Sidekiq::Matchers::HaveEnqueuedSidekiqJob Private

Inherits:
Base
  • Object
show all
Defined in:
lib/rspec/sidekiq/matchers/have_enqueued_sidekiq_job.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Base

#actual_jobs, #expected_arguments, #expected_count, #expected_options, #klass

Instance Method Summary collapse

Methods inherited from Base

#at, #at_least, #at_most, #common_message, #count_message, #description, #exactly, #failure_message, #failure_message_when_negated, #formatted, #immediately, #in, #normalize_arguments, #on, #once, #set_expected_count, #thrice, #times, #twice, #with

Constructor Details

#initialize(expected_arguments) ⇒ HaveEnqueuedSidekiqJob

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of HaveEnqueuedSidekiqJob.



10
11
12
13
# File 'lib/rspec/sidekiq/matchers/have_enqueued_sidekiq_job.rb', line 10

def initialize(expected_arguments)
  super()
  @expected_arguments = normalize_arguments(expected_arguments)
end

Instance Method Details

#matches?(job_class) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rspec/sidekiq/matchers/have_enqueued_sidekiq_job.rb', line 15

def matches?(job_class)
  @klass = job_class

  @actual_jobs = EnqueuedJobs.new(klass)

  actual_jobs.includes?(
    expected_arguments == [] ? any_args : expected_arguments,
    expected_options,
    expected_count
  )
end

#prefix_messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
# File 'lib/rspec/sidekiq/matchers/have_enqueued_sidekiq_job.rb', line 27

def prefix_message
  "have enqueued"
end