Class: Cucumber::Distrib::Leader::CucumberHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/distrib/leader/cucumber_helper.rb

Overview

Helper that handles some cases with Cucumber.

Class Method Summary collapse

Class Method Details

.failures_of(events) ⇒ Array<Exception>

Get failures of events.

Parameters:

Returns:

  • (Array<Exception>)


11
12
13
14
15
16
17
18
19
# File 'lib/cucumber/distrib/leader/cucumber_helper.rb', line 11

def failures_of(events)
  events.map do |ev|
    ex = ev.result.exception
    # Collect only exceptions, not `pending` or `skipped` wrappers.
    ex.is_a?(::Cucumber::Core::Test::Result::Raisable) ? nil : ex
  rescue StandardError
    nil
  end.compact
end

.unpack_causes(exceptions) ⇒ Array<Exception>

Extract all causes of exceptions to a list.

Parameters:

  • exceptions (Array<Exception>)

Returns:

  • (Array<Exception>)


25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cucumber/distrib/leader/cucumber_helper.rb', line 25

def unpack_causes(exceptions)
  exceptions.map do |exception|
    causes = []

    while exception
      causes << exception
      exception = exception.cause
    end

    causes
  end
end