waitforit 0.0.0.pre6 → 0.0.1.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/waitforit.rb +1 -1
- data/spec/waitforit_spec.rb +11 -15
- data/waitforit.gemspec +4 -7
- metadata +6 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,8 +3,8 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.1.2)
|
5
5
|
git (1.2.5)
|
6
|
-
jeweler (1.
|
7
|
-
bundler (~> 1.0
|
6
|
+
jeweler (1.6.4)
|
7
|
+
bundler (~> 1.0)
|
8
8
|
git (>= 1.2.5)
|
9
9
|
rake
|
10
10
|
rake (0.9.2)
|
@@ -21,5 +21,5 @@ PLATFORMS
|
|
21
21
|
ruby
|
22
22
|
|
23
23
|
DEPENDENCIES
|
24
|
-
jeweler
|
24
|
+
jeweler
|
25
25
|
rspec
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1.pre1
|
data/lib/waitforit.rb
CHANGED
@@ -12,7 +12,7 @@ class Fixnum
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def wait_until opts={}
|
15
|
-
opts
|
15
|
+
opts.merge!(:timeout_after => 2.seconds,:retry_every => 0.1.seconds)
|
16
16
|
start_time = Time.now
|
17
17
|
until Time.now > start_time + opts[:timeout_after]
|
18
18
|
return if yield == true
|
data/spec/waitforit_spec.rb
CHANGED
@@ -9,29 +9,25 @@ describe 'waitforit' do
|
|
9
9
|
end
|
10
10
|
end_time.should be < Time.now
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it 'should throw an exception if when the prescribed action does not happen in time' do
|
14
|
-
expect
|
14
|
+
expect{wait_until{false}}.to raise_error RuntimeError
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it 'should keep trying for a specified period' do
|
18
18
|
start_time = Time.now
|
19
19
|
wait_time = 1.second
|
20
|
-
|
21
|
-
lambda
|
22
|
-
|
23
|
-
(start_time + wait_time).should be >= Time.now
|
20
|
+
|
21
|
+
lambda{wait_until(:timeout_after => wait_time){false}}
|
22
|
+
|
23
|
+
(start_time + wait_time).should be >= Time.now
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it 'should be possible for user to supply the retry time' do
|
27
27
|
count = 0
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
count += 1
|
32
|
-
end
|
33
|
-
rescue
|
34
|
-
count.should == 2
|
28
|
+
wait_until(:timeout_after => 2.seconds, :retry_every => 0.5.seconds) do
|
29
|
+
count += 1
|
30
|
+
count == 4
|
35
31
|
end
|
36
32
|
end
|
37
33
|
end
|
data/waitforit.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{waitforit}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.1.pre1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["lashd"]
|
@@ -37,22 +37,19 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.require_paths = ["lib"]
|
38
38
|
s.rubygems_version = %q{1.6.1}
|
39
39
|
s.summary = %q{Tired of sleeping when something is supposed to happen? use this to waitforit instead :)}
|
40
|
-
s.test_files = [
|
41
|
-
"spec/waitforit_spec.rb"
|
42
|
-
]
|
43
40
|
|
44
41
|
if s.respond_to? :specification_version then
|
45
42
|
s.specification_version = 3
|
46
43
|
|
47
44
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
-
s.add_development_dependency(%q<jeweler>, ["
|
45
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
49
46
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
50
47
|
else
|
51
|
-
s.add_dependency(%q<jeweler>, ["
|
48
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
52
49
|
s.add_dependency(%q<rspec>, [">= 0"])
|
53
50
|
end
|
54
51
|
else
|
55
|
-
s.add_dependency(%q<jeweler>, ["
|
52
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
56
53
|
s.add_dependency(%q<rspec>, [">= 0"])
|
57
54
|
end
|
58
55
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: waitforit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.1.pre1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- lashd
|
@@ -18,9 +18,9 @@ dependencies:
|
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: "0"
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
hash:
|
81
|
+
hash: -512404082193466775
|
82
82
|
segments:
|
83
83
|
- 0
|
84
84
|
version: "0"
|
@@ -95,5 +95,5 @@ rubygems_version: 1.6.1
|
|
95
95
|
signing_key:
|
96
96
|
specification_version: 3
|
97
97
|
summary: Tired of sleeping when something is supposed to happen? use this to waitforit instead :)
|
98
|
-
test_files:
|
99
|
-
|
98
|
+
test_files: []
|
99
|
+
|