Class: Stenotype::Test::Matchers::DiffSizeMatchesExpectation

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_count) ⇒ DiffSizeMatchesExpectation

Returns a new instance of DiffSizeMatchesExpectation.



12
13
14
15
# File 'lib/stenotype/test/matchers.rb', line 12

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

Instance Attribute Details

#expected_countObject (readonly)

Returns the value of attribute expected_count.



10
11
12
# File 'lib/stenotype/test/matchers.rb', line 10

def expected_count
  @expected_count
end

#matching_eventsObject (readonly)

Returns the value of attribute matching_events.



10
11
12
# File 'lib/stenotype/test/matchers.rb', line 10

def matching_events
  @matching_events
end

Instance Method Details

#failure_messageObject



17
18
19
# File 'lib/stenotype/test/matchers.rb', line 17

def failure_message
  "expected to see #{expected_count} event(s) but got #{matching_events.count} event(s)."
end

#matches?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/stenotype/test/matchers.rb', line 21

def matches?
  matching_events.count == expected_count
end