Class: RSpec::Rewind::RunnerComponents

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/rewind/runner_components.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(example:, configuration:, context:, logger:) ⇒ RunnerComponents

Returns a new instance of RunnerComponents.



13
14
15
16
17
18
19
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
60
61
62
63
64
65
66
67
68
69
# File 'lib/rspec/rewind/runner_components.rb', line 13

def initialize(example:, configuration:, context:, logger:)
  event_builder = RetryEventBuilder.new(
    example_source: context.source,
    metadata_keys: configuration.
  )
  notifier = RetryNotifier.new(
    configuration: configuration,
    debug: logger.method(:debug),
    reporter_message: logger.method(:reporter_message)
  )
  state_resetter = ExampleStateResetter.new(configuration: configuration)
  retry_policy = RetryPolicy.new(
    example: example,
    configuration: configuration,
    metadata: context.
  )
  retry_delay_resolver = RetryDelayResolver.new(
    configuration: configuration,
    metadata: context.,
    example: example,
    warn: logger.method(:reporter_message)
  )

  @retry_count_resolver = RetryCountResolver.new(
    configuration: configuration,
    metadata: context.
  )
  @attempt_runner = AttemptRunner.new(clock: configuration.clock)
  @retry_gate = RetryGate.new(
    configuration: configuration,
    retry_policy: retry_policy,
    debug: logger.method(:debug)
  )
  @retry_transition = RetryTransition.new(
    configuration: configuration,
    retry_delay_resolver: retry_delay_resolver,
    event_builder: event_builder,
    notifier: notifier,
    state_resetter: state_resetter,
    sleep: configuration.sleeper,
    clock: configuration.clock
  )
  @flaky_transition = FlakyTransition.new(
    event_builder: event_builder,
    notifier: notifier
  )
  @retry_loop = RetryLoop.new(
    example: example,
    context: context,
    retry_count_resolver: @retry_count_resolver,
    attempt_runner: @attempt_runner,
    retry_gate: @retry_gate,
    retry_transition: @retry_transition,
    flaky_transition: @flaky_transition,
    clock: configuration.clock
  )
end

Instance Attribute Details

#attempt_runnerObject (readonly)

Returns the value of attribute attempt_runner.



6
7
8
# File 'lib/rspec/rewind/runner_components.rb', line 6

def attempt_runner
  @attempt_runner
end

#flaky_transitionObject (readonly)

Returns the value of attribute flaky_transition.



6
7
8
# File 'lib/rspec/rewind/runner_components.rb', line 6

def flaky_transition
  @flaky_transition
end

#retry_count_resolverObject (readonly)

Returns the value of attribute retry_count_resolver.



6
7
8
# File 'lib/rspec/rewind/runner_components.rb', line 6

def retry_count_resolver
  @retry_count_resolver
end

#retry_gateObject (readonly)

Returns the value of attribute retry_gate.



6
7
8
# File 'lib/rspec/rewind/runner_components.rb', line 6

def retry_gate
  @retry_gate
end

#retry_loopObject (readonly)

Returns the value of attribute retry_loop.



6
7
8
# File 'lib/rspec/rewind/runner_components.rb', line 6

def retry_loop
  @retry_loop
end

#retry_transitionObject (readonly)

Returns the value of attribute retry_transition.



6
7
8
# File 'lib/rspec/rewind/runner_components.rb', line 6

def retry_transition
  @retry_transition
end