Class: Stenotype::Test::Matchers::EventEmitted

Inherits:
Object
  • Object
show all
Defined in:
lib/stenotype/test/matchers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matching_events, expected_event_name) ⇒ EventEmitted

Returns a new instance of EventEmitted.



66
67
68
69
# File 'lib/stenotype/test/matchers.rb', line 66

def initialize(matching_events, expected_event_name)
  @matching_events = matching_events
  @expected_event_name = expected_event_name
end

Instance Attribute Details

#expected_event_nameObject (readonly)

Returns the value of attribute expected_event_name.



64
65
66
# File 'lib/stenotype/test/matchers.rb', line 64

def expected_event_name
  @expected_event_name
end

#matching_eventsObject (readonly)

Returns the value of attribute matching_events.



64
65
66
# File 'lib/stenotype/test/matchers.rb', line 64

def matching_events
  @matching_events
end

Instance Method Details

#failure_messageObject



75
76
77
# File 'lib/stenotype/test/matchers.rb', line 75

def failure_message
  "expected to see a '#{expected_event_name}' event but got nothing"
end

#matches?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/stenotype/test/matchers.rb', line 71

def matches?
  matching_events.any?
end