Class: RSpec::Sidekiq::Matchers::BeRetryable
- Inherits:
-
Object
- Object
- RSpec::Sidekiq::Matchers::BeRetryable
- Defined in:
- lib/rspec/sidekiq/matchers/be_retryable.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ BeRetryable
constructor
A new instance of BeRetryable.
- #matches?(job) ⇒ Boolean
- #negative_failure_message ⇒ Object
- #number_of_description ⇒ Object
Constructor Details
#initialize(expected) ⇒ BeRetryable
Returns a new instance of BeRetryable.
9 10 11 |
# File 'lib/rspec/sidekiq/matchers/be_retryable.rb', line 9 def initialize expected @expected = expected end |
Instance Method Details
#description ⇒ Object
13 14 15 |
# File 'lib/rspec/sidekiq/matchers/be_retryable.rb', line 13 def description "retry #{number_of_description} times" end |
#failure_message ⇒ Object
17 18 19 |
# File 'lib/rspec/sidekiq/matchers/be_retryable.rb', line 17 def "expected #{@klass} to retry #{number_of_description} times but got #{@actual}" end |
#matches?(job) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/rspec/sidekiq/matchers/be_retryable.rb', line 21 def matches? job @klass = job.class @actual = @klass.["retry"] @actual == @expected end |
#negative_failure_message ⇒ Object
27 28 29 |
# File 'lib/rspec/sidekiq/matchers/be_retryable.rb', line 27 def "expected #{@klass} to not retry #{number_of_description} times" end |
#number_of_description ⇒ Object
31 32 33 |
# File 'lib/rspec/sidekiq/matchers/be_retryable.rb', line 31 def number_of_description @expected.is_a?(Fixnum) ? @expected : "the default number of" end |