Class: RSpec::Sidekiq::Matchers::BeUnique

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



9
10
11
# File 'lib/rspec/sidekiq/matchers/be_unique.rb', line 9

def description
  "be unique in the queue"
end

#failure_messageObject



13
14
15
# File 'lib/rspec/sidekiq/matchers/be_unique.rb', line 13

def failure_message
  "expected #{@klass} to be unique in the queue but it is not"
end

#matches?(job) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/rspec/sidekiq/matchers/be_unique.rb', line 17

def matches? job
  @klass = job.class
  @actual = @klass.get_sidekiq_options["unique"]
  @actual == true
end

#negative_failure_messageObject



23
24
25
# File 'lib/rspec/sidekiq/matchers/be_unique.rb', line 23

def negative_failure_message
  "expected #{@klass} to not be unique in the queue"
end