Class: RSpec::Rewind::Configuration

Inherits:
Object
  • Object
show all
Includes:
ConfigurationValidation, MatcherValidation
Defined in:
lib/rspec/rewind/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



20
21
22
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
52
53
54
55
56
57
58
59
# File 'lib/rspec/rewind/configuration.rb', line 20

def initialize
  self.default_retries = 0
  self.backoff = Backoff.fixed(0)
  self.strict_matcher_validation = false
  self.retry_on = []
  self.skip_retry_on = []
  self.retry_if = nil
  self.retry_callback = nil
  self.flaky_callback = nil
  self.not_retried_callback = nil
  self.before_retry = nil
  self.after_retry = nil
  self.retry_summary = RetrySummary.new
  self.verbose = false
  self.display_retry_failure_messages = false
  self.display_retry_backtrace_top = false
  self.display_retry_summary = false
  self.fail_on_flaky = false
  self.max_flaky_examples = nil
  self.freeze_configuration_at_suite_start = false
  self.warn_on_delay_conflict = true
  self.detect_retry_gem_conflicts = true
  self.clear_lets_on_failure = true
  self.reset_failure_policy = :raise
  self.retry_budget = nil
  self.flaky_reporter = FlakyReporter.null
  self.flaky_report_path = nil
  self.retry_if_mode = :override
  self.retry_on_default = :all
  self.report_retry_events = false
  self.strict_callbacks = false
  self.strict_callable_arity = false
  self. = []
  self.max_retries = nil
  self.max_elapsed_time = nil
  self.max_total_sleep = nil
  self.sleeper = Kernel.method(:sleep)
  self.clock = -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) }
  self.dry_run = false
end

Instance Attribute Details

#after_retryObject

Returns the value of attribute after_retry.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def after_retry
  @after_retry
end

#backoffObject

Returns the value of attribute backoff.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def backoff
  @backoff
end

#before_retryObject

Returns the value of attribute before_retry.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def before_retry
  @before_retry
end

#clear_lets_on_failureObject

Returns the value of attribute clear_lets_on_failure.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def clear_lets_on_failure
  @clear_lets_on_failure
end

#clockObject

Returns the value of attribute clock.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def clock
  @clock
end

#default_retriesObject

Returns the value of attribute default_retries.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def default_retries
  @default_retries
end

#detect_retry_gem_conflictsObject

Returns the value of attribute detect_retry_gem_conflicts.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def detect_retry_gem_conflicts
  @detect_retry_gem_conflicts
end

#display_retry_backtrace_topObject

Returns the value of attribute display_retry_backtrace_top.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def display_retry_backtrace_top
  @display_retry_backtrace_top
end

#display_retry_failure_messagesObject

Returns the value of attribute display_retry_failure_messages.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def display_retry_failure_messages
  @display_retry_failure_messages
end

#display_retry_summaryObject

Returns the value of attribute display_retry_summary.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def display_retry_summary
  @display_retry_summary
end

#dry_runObject

Returns the value of attribute dry_run.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def dry_run
  @dry_run
end

#fail_on_flakyObject

Returns the value of attribute fail_on_flaky.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def fail_on_flaky
  @fail_on_flaky
end

#flaky_callbackObject

Returns the value of attribute flaky_callback.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def flaky_callback
  @flaky_callback
end

#flaky_report_pathObject

Returns the value of attribute flaky_report_path.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def flaky_report_path
  @flaky_report_path
end

#flaky_reporterObject

Returns the value of attribute flaky_reporter.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def flaky_reporter
  @flaky_reporter
end

#freeze_configuration_at_suite_startObject

Returns the value of attribute freeze_configuration_at_suite_start.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def freeze_configuration_at_suite_start
  @freeze_configuration_at_suite_start
end

#max_elapsed_timeObject

Returns the value of attribute max_elapsed_time.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def max_elapsed_time
  @max_elapsed_time
end

#max_flaky_examplesObject

Returns the value of attribute max_flaky_examples.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def max_flaky_examples
  @max_flaky_examples
end

#max_retriesObject

Returns the value of attribute max_retries.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def max_retries
  @max_retries
end

#max_total_sleepObject

Returns the value of attribute max_total_sleep.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def max_total_sleep
  @max_total_sleep
end

#metadata_report_keysObject

Returns the value of attribute metadata_report_keys.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def 
  @metadata_report_keys
end

#not_retried_callbackObject

Returns the value of attribute not_retried_callback.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def not_retried_callback
  @not_retried_callback
end

#report_retry_eventsObject

Returns the value of attribute report_retry_events.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def report_retry_events
  @report_retry_events
end

#reset_failure_policyObject

Returns the value of attribute reset_failure_policy.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def reset_failure_policy
  @reset_failure_policy
end

#retry_budgetObject

Returns the value of attribute retry_budget.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def retry_budget
  @retry_budget
end

#retry_callbackObject

Returns the value of attribute retry_callback.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def retry_callback
  @retry_callback
end

#retry_ifObject

Returns the value of attribute retry_if.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def retry_if
  @retry_if
end

#retry_if_modeObject

Returns the value of attribute retry_if_mode.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def retry_if_mode
  @retry_if_mode
end

#retry_onObject

Returns the value of attribute retry_on.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def retry_on
  @retry_on
end

#retry_on_defaultObject

Returns the value of attribute retry_on_default.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def retry_on_default
  @retry_on_default
end

#retry_summaryObject

Returns the value of attribute retry_summary.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def retry_summary
  @retry_summary
end

#skip_retry_onObject

Returns the value of attribute skip_retry_on.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def skip_retry_on
  @skip_retry_on
end

#sleeperObject

Returns the value of attribute sleeper.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def sleeper
  @sleeper
end

#strict_callable_arityObject

Returns the value of attribute strict_callable_arity.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def strict_callable_arity
  @strict_callable_arity
end

#strict_callbacksObject

Returns the value of attribute strict_callbacks.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def strict_callbacks
  @strict_callbacks
end

#strict_matcher_validationObject

Returns the value of attribute strict_matcher_validation.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def strict_matcher_validation
  @strict_matcher_validation
end

#verboseObject

Returns the value of attribute verbose.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def verbose
  @verbose
end

#warn_on_delay_conflictObject

Returns the value of attribute warn_on_delay_conflict.



9
10
11
# File 'lib/rspec/rewind/configuration.rb', line 9

def warn_on_delay_conflict
  @warn_on_delay_conflict
end

Instance Method Details

#freezeObject



237
238
239
240
# File 'lib/rspec/rewind/configuration.rb', line 237

def freeze
  freeze_mutable_policy_state
  super
end

#snapshotObject



242
243
244
245
246
247
248
# File 'lib/rspec/rewind/configuration.rb', line 242

def snapshot
  copy = dup
  copy.instance_variable_set(:@retry_on, @retry_on.dup)
  copy.instance_variable_set(:@skip_retry_on, @skip_retry_on.dup)
  copy.instance_variable_set(:@metadata_report_keys, @metadata_report_keys.dup)
  copy.freeze
end