class RSpec::Sidekiq::Matchers::BeUnique::Base
Public Instance Methods
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 22 def description 'be unique in the queue' end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 62 def expiration_matches? @expected_expiration.nil? || actual_expiration == @expected_expiration end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 26 def failure_message if !interval_matches? && @expected_interval "expected #{@klass} to be unique for #{@expected_interval} seconds, "\ "but its interval was #{actual_interval} seconds" elsif !expiration_matches? "expected #{@klass} to be unique until #{@expected_expiration}, "\ "but its unique_until was #{actual_expiration || 'not specified'}" else "expected #{@klass} to be unique in the queue" end end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 66 def failure_message_when_negated "expected #{@klass} to not be unique in the queue" end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 44 def for(interval) @expected_interval = interval self end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 58 def interval_matches? !interval_specified? || actual_interval == @expected_interval end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 54 def interval_specified? @expected_interval end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 38 def matches?(job) @klass = job.is_a?(Class) ? job : job.class @actual = @klass.get_sidekiq_options[unique_key] !!(value_matches? && interval_matches? && expiration_matches?) end
Source
# File lib/rspec/sidekiq/matchers/be_unique.rb, line 49 def until(expiration) @expected_expiration = expiration self end