Class: Evilution::Integration::CrashDetector Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/integration/crash_detector.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_output) ⇒ CrashDetector

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CrashDetector.



10
11
12
# File 'lib/evilution/integration/crash_detector.rb', line 10

def initialize(_output)
  reset
end

Class Method Details

.register_with_rspecObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
# File 'lib/evilution/integration/crash_detector.rb', line 6

def self.register_with_rspec
  ::RSpec::Core::Formatters.register self, :example_failed
end

Instance Method Details

#assertion_failure?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


29
30
31
# File 'lib/evilution/integration/crash_detector.rb', line 29

def assertion_failure?
  @assertion_failures.positive?
end

#crash_summaryObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
44
45
# File 'lib/evilution/integration/crash_detector.rb', line 41

def crash_summary
  return nil if @crashes.empty?

  "#{unique_crash_classes.join(", ")} (#{@crashes.length} crash#{"es" unless @crashes.length == 1})"
end

#crashed?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


33
34
35
# File 'lib/evilution/integration/crash_detector.rb', line 33

def crashed?
  @crashes.any?
end

#example_failed(notification) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
25
26
27
# File 'lib/evilution/integration/crash_detector.rb', line 19

def example_failed(notification)
  exception = notification.example.exception

  if assertion_exception?(exception)
    @assertion_failures += 1
  else
    @crashes << exception
  end
end

#only_crashes?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


37
38
39
# File 'lib/evilution/integration/crash_detector.rb', line 37

def only_crashes?
  @crashes.any? && @assertion_failures.zero?
end

#resetObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
# File 'lib/evilution/integration/crash_detector.rb', line 14

def reset
  @assertion_failures = 0
  @crashes = []
end

#unique_crash_classesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
# File 'lib/evilution/integration/crash_detector.rb', line 47

def unique_crash_classes
  @crashes.map { |e| e.class.name }.uniq
end