Class: RSpec::Sidekiq::Matchers::EnqueueSidekiqJob Private
- Defined in:
- lib/rspec/sidekiq/matchers/enqueue_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 collapse
-
#original_jobs ⇒ Object
readonly
private
Plus that from Base.
Attributes inherited from Base
#actual_jobs, #expected_arguments, #expected_count, #expected_options, #klass
Instance Method Summary collapse
-
#initialize(job_class) ⇒ EnqueueSidekiqJob
constructor
private
A new instance of EnqueueSidekiqJob.
- #matches?(proc) ⇒ Boolean private
- #prefix_message ⇒ Object private
- #supports_block_expectations? ⇒ Boolean private
Methods inherited from Base
#at, #at_least, #at_most, #common_message, #count_message, #description, #exactly, #failure_message, #failure_message_when_negated, #formatted, #immediately, #in, #never, #normalize_arguments, #on, #once, #set_expected_count, #thrice, #times, #twice, #with, #with_context
Constructor Details
#initialize(job_class) ⇒ EnqueueSidekiqJob
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 EnqueueSidekiqJob.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rspec/sidekiq/matchers/enqueue_sidekiq_job.rb', line 10 def initialize(job_class) super() default = if RSpec::Sidekiq.configuration.sidekiq_gte_7? ::Sidekiq::Job else ::Sidekiq::Worker end @klass = job_class || default end |
Instance Attribute Details
#original_jobs ⇒ Object (readonly)
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.
Plus that from Base
8 9 10 |
# File 'lib/rspec/sidekiq/matchers/enqueue_sidekiq_job.rb', line 8 def original_jobs @original_jobs end |
Instance Method Details
#matches?(proc) ⇒ 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.
21 22 23 24 25 26 27 28 29 |
# File 'lib/rspec/sidekiq/matchers/enqueue_sidekiq_job.rb', line 21 def matches?(proc) raise ArgumentError, "Only block syntax supported for enqueue_sidekiq_job" unless Proc === proc @original_jobs = EnqueuedJobs.new(@klass) proc.call @actual_jobs = EnqueuedJobs.new(@klass).minus!(original_jobs) @actual_jobs.includes?(expected_arguments, , expected_count) end |
#prefix_message ⇒ Object
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.
31 32 33 |
# File 'lib/rspec/sidekiq/matchers/enqueue_sidekiq_job.rb', line 31 def "enqueue" end |
#supports_block_expectations? ⇒ 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.
35 36 37 |
# File 'lib/rspec/sidekiq/matchers/enqueue_sidekiq_job.rb', line 35 def supports_block_expectations? true end |