Class: RSpec::Rewind::RetryPolicy
- Inherits:
-
Object
- Object
- RSpec::Rewind::RetryPolicy
- Includes:
- MatcherValidation
- Defined in:
- lib/rspec/rewind/retry_policy.rb
Instance Method Summary collapse
- #decision(exception:, retry_on:, skip_retry_on:, retry_if:, retry_number: nil, resolved_retries: nil, budget_remaining: nil, elapsed_time: nil, sleep_total: nil) ⇒ Object
-
#initialize(example:, configuration:, metadata:) ⇒ RetryPolicy
constructor
A new instance of RetryPolicy.
- #retry_allowed?(exception:, retry_on:, skip_retry_on:, retry_if:) ⇒ Boolean
Constructor Details
#initialize(example:, configuration:, metadata:) ⇒ RetryPolicy
Returns a new instance of RetryPolicy.
8 9 10 11 12 |
# File 'lib/rspec/rewind/retry_policy.rb', line 8 def initialize(example:, configuration:, metadata:) @example = example @configuration = configuration @metadata = || {} end |
Instance Method Details
#decision(exception:, retry_on:, skip_retry_on:, retry_if:, retry_number: nil, resolved_retries: nil, budget_remaining: nil, elapsed_time: nil, sleep_total: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rspec/rewind/retry_policy.rb', line 23 def decision( exception:, retry_on:, skip_retry_on:, retry_if:, retry_number: nil, resolved_retries: nil, budget_remaining: nil, elapsed_time: nil, sleep_total: nil ) RetryDecision.new( exception: exception, example: @example, retry_on: effective_retry_on(retry_on), skip_retry_on: effective_skip_retry_on(skip_retry_on), retry_if: effective_retry_if(retry_if), retry_on_default: @configuration.retry_on_default, strict_callable_arity: @configuration.strict_callable_arity, context: retry_context( retry_number: retry_number, resolved_retries: resolved_retries, budget_remaining: budget_remaining, elapsed_time: elapsed_time, sleep_total: sleep_total, exception: exception ) ).decision end |
#retry_allowed?(exception:, retry_on:, skip_retry_on:, retry_if:) ⇒ Boolean
14 15 16 17 18 19 20 21 |
# File 'lib/rspec/rewind/retry_policy.rb', line 14 def retry_allowed?(exception:, retry_on:, skip_retry_on:, retry_if:) decision( exception: exception, retry_on: retry_on, skip_retry_on: skip_retry_on, retry_if: retry_if ).allowed? end |