Module: Fried::Test::Telemetry

Defined Under Namespace

Classes: Record

Instance Method Summary collapse

Instance Method Details

#record(signal, data = nil) ⇒ Object



8
9
10
11
12
# File 'lib/fried/test/telemetry.rb', line 8

def record(signal, data = nil)
  @__telemetry_records__ ||= []
  time = Time.now.utc
  @__telemetry_records__ << Record.new(signal, time, data)
end

#recorded?(signal) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/fried/test/telemetry.rb', line 14

def recorded?(signal)
  @__telemetry_records__.any? do |recorded|
    recorded.signal == signal
  end
end

#recorded_times?(signal, amount) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/fried/test/telemetry.rb', line 27

def recorded_times?(signal, amount)
  @__telemetry_records__.count do |recorded|
    recorded.signal == signal
  end
end

#recorded_with?(signal, data) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
# File 'lib/fried/test/telemetry.rb', line 20

def recorded_with?(signal, data)
  @__telemetry_records__.any? do |recorded|
    recorded.signal == signal &&
    recorded.data == data
  end
end