class RSpec::Sidekiq::Matchers::BeRetryable
Public Class Methods
Source
# File lib/rspec/sidekiq/matchers/be_retryable.rb, line 11 def initialize(expected_retry) @expected_retry = expected_retry end
Public Instance Methods
Source
# File lib/rspec/sidekiq/matchers/be_retryable.rb, line 15 def description if @expected_retry.is_a?(Numeric) "retry #{@expected_retry} times" # retry: 5 elsif @expected_retry 'retry the default number of times' # retry: true else 'not retry' # retry: false end end
Source
# File lib/rspec/sidekiq/matchers/be_retryable.rb, line 25 def failure_message "expected #{@klass} to #{description} but got #{@actual}" end
Source
# File lib/rspec/sidekiq/matchers/be_retryable.rb, line 35 def failure_message_when_negated "expected #{@klass} to not #{description}".gsub 'not not ', '' end
Source
# File lib/rspec/sidekiq/matchers/be_retryable.rb, line 29 def matches?(job) @klass = job.is_a?(Class) ? job : job.class @actual = @klass.get_sidekiq_options['retry'] @actual == @expected_retry end