rubocop: disable Style/ClassLength @private
# File lib/rspec/rails/matchers/active_job.rb, line 14 def initialize @args = [] @queue = nil @at = nil @block = Proc.new {} set_expected_number(:exactly, 1) end
# File lib/rspec/rails/matchers/active_job.rb, line 33 def at(date) @at = date self end
# File lib/rspec/rails/matchers/active_job.rb, line 43 def at_least(count) set_expected_number(:at_least, count) self end
# File lib/rspec/rails/matchers/active_job.rb, line 48 def at_most(count) set_expected_number(:at_most, count) self end
# File lib/rspec/rails/matchers/active_job.rb, line 38 def exactly(count) set_expected_number(:exactly, count) self end
# File lib/rspec/rails/matchers/active_job.rb, line 69 def failure_message "expected to enqueue #{base_message}".tap do |msg| if @unmatching_jobs.any? msg << "\nQueued jobs:" @unmatching_jobs.each do |job| msg << "\n #{base_job_message(job)}" end end end end
# File lib/rspec/rails/matchers/active_job.rb, line 80 def failure_message_when_negated "expected not to enqueue #{base_message}" end
# File lib/rspec/rails/matchers/active_job.rb, line 84 def message_expectation_modifier case @expectation_type when :exactly then "exactly" when :at_most then "at most" when :at_least then "at least" end end
# File lib/rspec/rails/matchers/active_job.rb, line 28 def on_queue(queue) @queue = queue self end
# File lib/rspec/rails/matchers/active_job.rb, line 57 def once exactly(:once) end
# File lib/rspec/rails/matchers/active_job.rb, line 92 def supports_block_expectations? true end
# File lib/rspec/rails/matchers/active_job.rb, line 65 def thrice exactly(:thrice) end
# File lib/rspec/rails/matchers/active_job.rb, line 53 def times self end
# File lib/rspec/rails/matchers/active_job.rb, line 61 def twice exactly(:twice) end
# File lib/rspec/rails/matchers/active_job.rb, line 22 def with(*args, &block) @args = args @block = block if block.present? self end