class RSpec::Rails::Matchers::ActiveJob::Base

rubocop: disable Style/ClassLength @private

Public Instance Methods

at(date) click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 33
def at(date)
  @at = date
  self
end
at_least(count) click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 43
def at_least(count)
  set_expected_number(:at_least, count)
  self
end
at_most(count) click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 48
def at_most(count)
  set_expected_number(:at_most, count)
  self
end
exactly(count) click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 38
def exactly(count)
  set_expected_number(:exactly, count)
  self
end
failure_message() click to toggle source
# 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
failure_message_when_negated() click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 80
def failure_message_when_negated
  "expected not to enqueue #{base_message}"
end
message_expectation_modifier() click to toggle source
# 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
on_queue(queue) click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 28
def on_queue(queue)
  @queue = queue
  self
end
once() click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 57
def once
  exactly(:once)
end
supports_block_expectations?() click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 92
def supports_block_expectations?
  true
end
thrice() click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 65
def thrice
  exactly(:thrice)
end
times() click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 53
def times
  self
end
twice() click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 61
def twice
  exactly(:twice)
end
with(*args, &block) click to toggle source
# File lib/rspec/rails/matchers/active_job.rb, line 22
def with(*args, &block)
  @args = args
  @block = block if block.present?
  self
end

Public Class Methods

new() click to toggle source
# 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