method

event_matcher

rails latest stable - Class: ActiveSupport::EventReporter::TestHelper

Method not available on this version

This method is only available on newer versions. The first available version (v8.1.1) is shown here.

event_matcher(name:, payload: nil, tags: {}, context: {}, source_location: nil)
public

No documentation available.

# File activesupport/lib/active_support/event_reporter/test_helper.rb, line 16
  def event_matcher(name,, payload: nil, tags: {}, context: {}, source_location: nil)
    ->(event) {
      return false unless event[:name] == name
      return false unless event[:payload] == payload
      return false unless event[:tags] == tags
      return false unless event[:context] == context

      [:filepath, :lineno, :label].each do |key|
        if source_location && source_location[key]
          return false unless event[:source_location][key] == source_location[key]
        end
      end

      true
    }
  end