module Stenotype::Test::Matchers

Public Instance Methods

first_failure() click to toggle source
# File lib/stenotype/test/matchers.rb, line 115
def first_failure
  @first_failure ||= partial_matchers.detect { |matcher| !matcher.matches? }
end
matching_events() click to toggle source
# File lib/stenotype/test/matchers.rb, line 100
def matching_events
  @matching_events ||= begin
    buffer_before_emit = stenotype_event_buffer.dup
    @emitting_event_block.call
    buffer_after_emit = stenotype_event_buffer.dup

    diff = buffer_after_emit - buffer_before_emit
    diff.select { |event| event["name"] == expected_event_name.to_s }
  end
end
partial_matchers() click to toggle source
# File lib/stenotype/test/matchers.rb, line 111
def partial_matchers
  @partial_matchers ||= []
end
should_validate_attributes?() click to toggle source
# File lib/stenotype/test/matchers.rb, line 131
def should_validate_attributes?
  @arguments_should_include.present?
end
should_validate_events_count?() click to toggle source
# File lib/stenotype/test/matchers.rb, line 127
def should_validate_events_count?
  @matching_events_count.present?
end
stenotype_event_buffer() click to toggle source
# File lib/stenotype/test/matchers.rb, line 135
def stenotype_event_buffer
  stenotype_event_target.buffer
end
stenotype_event_target() click to toggle source
# File lib/stenotype/test/matchers.rb, line 139
def stenotype_event_target
  Stenotype.config.targets.first
end