Module: ActiveSupport::Testing::ErrorReporterAssertions::ErrorCollector

Defined in:
activesupport/lib/active_support/testing/error_reporter_assertions.rb

Defined Under Namespace

Classes: Report

Class Method Summary collapse

Class Method Details

.recordObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'activesupport/lib/active_support/testing/error_reporter_assertions.rb', line 16

def record
  subscribe
  recorders = ActiveSupport::IsolatedExecutionState[:active_support_error_reporter_assertions] ||= []
  reports = []
  recorders << reports
  begin
    yield
    reports
  ensure
    recorders.delete_if { |r| reports.equal?(r) }
  end
end

.report(error, **kwargs) ⇒ Object



29
30
31
32
33
34
35
# File 'activesupport/lib/active_support/testing/error_reporter_assertions.rb', line 29

def report(error, **kwargs)
  report = Report.new(error: error, **kwargs)
  ActiveSupport::IsolatedExecutionState[:active_support_error_reporter_assertions]&.each do |reports|
    reports << report
  end
  true
end