123456789_123456789_123456789_123456789_123456789_

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

Do not use. This module is for internal use only.
Relationships & Source Files
Namespace Children
Classes:
Defined in: activesupport/lib/active_support/testing/error_reporter_assertions.rb

Class Method Summary

Class Method Details

.record

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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

.subscribe (private)

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/error_reporter_assertions.rb', line 38

def subscribe
  return if @subscribed
  @mutex.synchronize do
    return if @subscribed

    if ActiveSupport.error_reporter
      ActiveSupport.error_reporter.subscribe(self)
      @subscribed = true
    else
      raise Minitest::Assertion, "No error reporter is configured"
    end
  end
end