class RSpec::Sidekiq::Matchers::BeUnique::Base

Public Instance Methods

description() click to toggle source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 20
def description
  'be unique in the queue'
end
failure_message() click to toggle source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 24
def failure_message
  if !interval_matches? && @expected_interval
    "expected #{@klass} to be unique for #{@expected_interval} seconds, "\
    "but its interval was #{actual_interval} seconds"
  else
    "expected #{@klass} to be unique in the queue"
  end
end
failure_message_when_negated() click to toggle source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 52
def failure_message_when_negated
  "expected #{@klass} to not be unique in the queue"
end
for(interval) click to toggle source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 39
def for(interval)
  @expected_interval = interval
  self
end
interval_matches?() click to toggle source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 48
def interval_matches?
  !interval_specified? || actual_interval == @expected_interval
end
interval_specified?() click to toggle source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 44
def interval_specified?
  @expected_interval
end
matches?(job) click to toggle source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 33
def matches?(job)
  @klass = job.is_a?(Class) ? job : job.class
  @actual = @klass.get_sidekiq_options[unique_key]
  !!(value_matches? && interval_matches?)
end