Sha256: 2fa5c1b4a648de0e5fcba4c46d7ff8a1a7faf42dcaba3887166a605cb2f93646
Contents?: true
Size: 601 Bytes
Versions: 10
Compression:
Stored size: 601 Bytes
Contents
require 'spec_helper' require 'timers/wait' RSpec.describe Timers::Wait do it "repeats until timeout expired" do timeout = Timers::Wait.new(5) count = 0 timeout.while_time_remaining do |remaining| expect(remaining).to be_within(TIMER_QUANTUM).of (timeout.duration - count) count += 1 sleep 1 end expect(count).to eq(5) end it "yields results as soon as possible" do timeout = Timers::Wait.new(5) result = timeout.while_time_remaining do |remaining| break :done end expect(result).to eq(:done) end end
Version data entries
10 entries across 8 versions & 4 rubygems