Class: Maze::ErrorMonitor::AssertErrorMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/maze/error_monitor/assert_error_middleware.rb

Constant Summary collapse

IGNORE_CLASS_NAME =
'Test::Unit::AssertionFailedError'

Instance Method Summary collapse

Constructor Details

#initialize(middleware) ⇒ AssertErrorMiddleware

Returns a new instance of AssertErrorMiddleware.

Parameters:

  • middleware (#call)

    The next middleware to call



7
8
9
# File 'lib/maze/error_monitor/assert_error_middleware.rb', line 7

def initialize(middleware)
  @middleware = middleware
end

Instance Method Details

#call(report) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/maze/error_monitor/assert_error_middleware.rb', line 11

def call(report)
  # Only ignore automated notifies with assertion errors
  automated = report.unhandled

  class_match = report.raw_exceptions.any? do |ex|
    ex.class.name.eql?(IGNORE_CLASS_NAME)
  end

  report.ignore! if automated && class_match

  @middleware.call(report)
end