class Libhoney::MockTransmissionClient

For testing use: a mock version of TransmissionClient that retains all events in an in-memory queue for inspection (and does not send them to Honeycomb, or perform any network activity).

@note This class is intended for use in tests, for example if you want to

verify what events your instrumented code is sending. Use in
production is not recommended.

Attributes

events[R]

@return [Array<Event>] the recorded events

Public Class Methods

new(**_) click to toggle source
# File lib/libhoney/mock_transmission.rb, line 10
def initialize(**_)
  reset
end

Public Instance Methods

add(event) click to toggle source

Records an event

# File lib/libhoney/mock_transmission.rb, line 18
def add(event)
  @events.push(event)
end
close(drain) click to toggle source

Does nothing.

# File lib/libhoney/mock_transmission.rb, line 23
def close(drain); end
reset() click to toggle source

Discards the recorded events

# File lib/libhoney/mock_transmission.rb, line 26
def reset
  @events = []
end