test/test_track_stream.rb in powertrack-1.3.0 vs test/test_track_stream.rb in powertrack-1.3.1
- old
+ new
@@ -20,10 +20,11 @@
track_simple_stream(true, true)
end
def track_simple_stream(v2, replay)
stream = new_stream(v2, replay)
+ assert_equal !!v2, stream.v2?
# add a logger
stream.logger = Logger.new(STDERR)
new_rule = PowerTrack::Rule.new('ny OR nyc OR #nyc OR new york')
@@ -97,13 +98,12 @@
ended_at = Time.now
assert_nil res
assert replay || closed, 'Stream not closed'
- if replay
- assert (ended_at - started_at) <= delay
- else
- assert (ended_at - started_at) >= delay
+ # a replay may take longer than the delay it passes over...
+ unless replay
+ assert (ended_at - started_at) >= delay, "#{ended_at - started_at}s < #{delay}s"
end
# heartbeats only sent every 10 minutes in v2...
assert heartbeats > 0, 'No heartbeat received' unless v2
puts "#{heartbeats} heartbeats received"