timers 4.1.2 → 4.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe Timers::Group do
4
- it "should not diverge too much" do
5
- fired = :not_fired_yet
6
- count = 0
7
- quantum = 0.01
8
-
9
- start_offset = subject.current_offset
10
- Timers::Timer.new(subject, quantum, :strict, start_offset) do |offset|
11
- fired = offset
12
- count += 1
13
- end
14
-
15
- iterations = 1000
16
- subject.wait while count < iterations
17
-
18
- # In my testing on the JVM, without the :strict recurring, I noticed 60ms of error here.
19
- expect(fired - start_offset).to be_within(quantum).of(iterations * quantum)
20
- end
21
-
22
- it "should only fire once" do
23
- fired = :not_fired_yet
24
- count = 0
25
-
26
- start_offset = subject.current_offset
27
- Timers::Timer.new(subject, 0, :strict, start_offset) do |offset|
28
- fired = offset
29
- count += 1
30
- end
31
-
32
- subject.wait
33
-
34
- expect(count).to be == 1
35
- end
36
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
- require "timers/wait"
5
-
6
- RSpec.describe Timers::Wait do
7
- it "repeats until timeout expired" do
8
- timeout = Timers::Wait.new(5)
9
- count = 0
10
-
11
- timeout.while_time_remaining do |remaining|
12
- expect(remaining).to be_within(TIMER_QUANTUM).of(timeout.duration - count)
13
-
14
- count += 1
15
- sleep 1
16
- end
17
-
18
- expect(count).to eq(5)
19
- end
20
-
21
- it "yields results as soon as possible" do
22
- timeout = Timers::Wait.new(5)
23
-
24
- result = timeout.while_time_remaining do |_remaining|
25
- break :done
26
- end
27
-
28
- expect(result).to eq(:done)
29
- end
30
- end
@@ -1,26 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # frozen_string_literal: true
3
-
4
- require File.expand_path("../lib/timers/version", __FILE__)
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = "timers"
8
- gem.version = Timers::VERSION
9
- gem.authors = ["Tony Arcieri"]
10
- gem.email = ["bascule@gmail.com"]
11
- gem.licenses = ["MIT"]
12
- gem.homepage = "https://github.com/celluloid/timers"
13
- gem.summary = "Pure Ruby one-shot and periodic timers"
14
- gem.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
15
- Schedule procs to run after a certain time, or at periodic intervals,
16
- using any API that accepts a timeout.
17
- DESCRIPTION
18
-
19
- gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
20
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
21
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
22
- gem.require_paths = ["lib"]
23
- gem.add_runtime_dependency "hitimes"
24
-
25
- gem.add_development_dependency "bundler"
26
- end