Class: ActiveSupport::Testing::EventReporterAssertions::EventCollector::Event
- Inherits:
-
Object
- Object
- ActiveSupport::Testing::EventReporterAssertions::EventCollector::Event
- Defined in:
- lib/active_support/testing/event_reporter_assertions.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#event_data ⇒ Object
readonly
Returns the value of attribute event_data.
Instance Method Summary collapse
-
#initialize(event_data) ⇒ Event
constructor
A new instance of Event.
- #inspect ⇒ Object
- #matches?(name, payload, tags) ⇒ Boolean
Constructor Details
#initialize(event_data) ⇒ Event
Returns a new instance of Event.
14 15 16 |
# File 'lib/active_support/testing/event_reporter_assertions.rb', line 14 def initialize(event_data) @event_data = event_data end |
Instance Attribute Details
#event_data ⇒ Object (readonly)
Returns the value of attribute event_data.
12 13 14 |
# File 'lib/active_support/testing/event_reporter_assertions.rb', line 12 def event_data @event_data end |
Instance Method Details
#inspect ⇒ Object
18 19 20 |
# File 'lib/active_support/testing/event_reporter_assertions.rb', line 18 def inspect "#{event_data[:name]} (payload: #{event_data[:payload].inspect}, tags: #{event_data[:tags].inspect})" end |
#matches?(name, payload, tags) ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/active_support/testing/event_reporter_assertions.rb', line 22 def matches?(name, payload, ) return false unless name.to_s == event_data[:name] if payload && payload.is_a?(Hash) return false unless matches_hash?(payload, :payload) end return false unless matches_hash?(, :tags) true end |