timers 4.1.1 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +0,0 @@
1
-
2
- require 'spec_helper'
3
-
4
- RSpec.describe Timers::Group do
5
- it "should not diverge too much" do
6
- fired = :not_fired_yet
7
- count = 0
8
- quantum = 0.01
9
-
10
- start_offset = subject.current_offset
11
- Timers::Timer.new(subject, quantum, :strict, start_offset) do |offset|
12
- fired = offset
13
- count += 1
14
- end
15
-
16
- iterations = 1000
17
- subject.wait while count < iterations
18
-
19
- # In my testing on the JVM, without the :strict recurring, I noticed 60ms of error here.
20
- expect(fired - start_offset).to be_within(quantum).of(iterations * quantum)
21
- end
22
-
23
- it "should only fire once" do
24
- fired = :not_fired_yet
25
- count = 0
26
-
27
- start_offset = subject.current_offset
28
- Timers::Timer.new(subject, 0, :strict, start_offset) do |offset|
29
- fired = offset
30
- count += 1
31
- end
32
-
33
- subject.wait
34
-
35
- expect(count).to be == 1
36
- end
37
- end
@@ -1,29 +0,0 @@
1
-
2
- require 'spec_helper'
3
- require 'timers/wait'
4
-
5
- RSpec.describe Timers::Wait do
6
- it "repeats until timeout expired" do
7
- timeout = Timers::Wait.new(5)
8
- count = 0
9
-
10
- timeout.while_time_remaining do |remaining|
11
- expect(remaining).to be_within(TIMER_QUANTUM).of (timeout.duration - count)
12
-
13
- count += 1
14
- sleep 1
15
- end
16
-
17
- expect(count).to eq(5)
18
- end
19
-
20
- it "yields results as soon as possible" do
21
- timeout = Timers::Wait.new(5)
22
-
23
- result = timeout.while_time_remaining do |remaining|
24
- break :done
25
- end
26
-
27
- expect(result).to eq(:done)
28
- end
29
- end
@@ -1,23 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/timers/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Tony Arcieri"]
6
- gem.email = ["tony.arcieri@gmail.com"]
7
- gem.description = "Pure Ruby one-shot and periodic timers"
8
- gem.summary = "Schedule procs to run after a certain time, or at periodic intervals, using any API that accepts a timeout"
9
- gem.homepage = "https://github.com/celluloid/timers"
10
-
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "timers"
15
- gem.require_paths = ["lib"]
16
- gem.version = Timers::VERSION
17
- gem.licenses = ['MIT']
18
-
19
- gem.add_runtime_dependency 'hitimes'
20
-
21
- gem.add_development_dependency 'rake'
22
- gem.add_development_dependency 'rspec', '~> 3.0.0'
23
- end