test-helpers 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/test-helpers/test-helpers.rb +0 -21
- data/lib/test-helpers/wait/wait.rb +27 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MDE2NGFjYjU3YzFhNzE4N2EyMzg0MDBiZDczMmRkYzBhZWM5MTg3NA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 920ee3129c40ca0492f68e11da238baec30bbf31
|
4
|
+
data.tar.gz: a400e5ad90296ae24fc56bbc68fb8ed731a2a9f7
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NDIyYzYwZDkzOTUzZjc2ZDk1ODlmMjMyNDNjODA1OGFjMzZkMTQ0ZWFkZGQx
|
11
|
-
YzVlOTY1ZjM3MDk4Njc2NzM2YzBiNjEwMDhmZmYwMDEwMjJmZjY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MDYyYThhNzJiZThjYjZkNzdmMDM0NDgxNDQzYzM0MGU5NGY3MTYxOTZiMWVl
|
14
|
-
MmE0NjMyOTg2ZmFhODhkM2I0NDdmYzMwMTVkZDQ2ODdkZDdiNTE4MWMxOWU1
|
15
|
-
OGRkZTg0MjliNGJmMWRiYjlkNDg4YTYzNGI0NWY4Mjk5MWJhNWI=
|
6
|
+
metadata.gz: f72f54b9124a18cbe9fa1900d698df7534f7bd8eb773ca0889980e6f9a8900689d3e34b795c4e836fb741184665786bd073969b16c064c93b89942052d125e24
|
7
|
+
data.tar.gz: a3aca5aecf82b8a105a557ca79148da938ffa4b6e5d551bc539a37ef60e6841f60cdb80a1bb2b5b5e4e0bbe822b3b5f17b73ecf61ea5c7b82e97949444c48680
|
@@ -1,25 +1,4 @@
|
|
1
1
|
$LOAD_PATH << File.dirname(__FILE__)
|
2
2
|
module TestHelpers
|
3
|
-
class << self
|
4
|
-
attr_accessor :configuration
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.configuration
|
8
|
-
@configuration ||= Configuration.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.configure
|
12
|
-
yield(configuration) if block_given?
|
13
|
-
end
|
14
|
-
|
15
|
-
class Configuration
|
16
|
-
attr_accessor :wait_timeout, :wait_interval, :default_error
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
@wait_timeout = 5.0
|
20
|
-
@wait_interval = 0.1
|
21
|
-
@default_error = TimeoutError.new('Timed out waiting for block')
|
22
|
-
end
|
23
|
-
end
|
24
3
|
|
25
4
|
end
|
@@ -1,9 +1,31 @@
|
|
1
1
|
module TestHelpers
|
2
2
|
module Wait
|
3
|
+
class << self
|
4
|
+
attr_accessor :configuration
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.configuration
|
8
|
+
@configuration ||= Configuration.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.configure
|
12
|
+
yield(configuration) if block_given?
|
13
|
+
end
|
14
|
+
|
15
|
+
class Configuration
|
16
|
+
attr_accessor :wait_timeout, :wait_interval, :default_error
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@wait_timeout = 5.0
|
20
|
+
@wait_interval = 0.1
|
21
|
+
@default_error = TimeoutError.new('Timed out waiting for block')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
3
25
|
def poll_and_assert(options = {})
|
4
26
|
return unless block_given?
|
5
|
-
timeout = Float(options[:timeout] || TestHelpers.configuration.wait_timeout)
|
6
|
-
interval = Float(options[:interval] || TestHelpers.configuration.wait_interval)
|
27
|
+
timeout = Float(options[:timeout] || TestHelpers::Wait.configuration.wait_timeout)
|
28
|
+
interval = Float(options[:interval] || TestHelpers::Wait.configuration.wait_interval)
|
7
29
|
end_time = ::Time.now + timeout
|
8
30
|
failure = nil
|
9
31
|
until ::Time.now > end_time
|
@@ -20,9 +42,9 @@ module TestHelpers
|
|
20
42
|
|
21
43
|
def wait_until(options = {})
|
22
44
|
return unless block_given?
|
23
|
-
timeout = Float(options[:timeout] || TestHelpers.configuration.wait_timeout)
|
24
|
-
interval = Float(options[:interval] || TestHelpers.configuration.wait_interval)
|
25
|
-
error = options[:error] || TestHelpers.configuration.default_error
|
45
|
+
timeout = Float(options[:timeout] || TestHelpers::Wait.configuration.wait_timeout)
|
46
|
+
interval = Float(options[:interval] || TestHelpers::Wait.configuration.wait_interval)
|
47
|
+
error = options[:error] || TestHelpers::Wait.configuration.default_error
|
26
48
|
end_time = ::Time.now + timeout
|
27
49
|
until ::Time.now > end_time
|
28
50
|
begin
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Umair Chagani, Manheim
|
@@ -14,14 +14,14 @@ dependencies:
|
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -58,17 +58,17 @@ require_paths:
|
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 1.9.3
|
64
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.4.
|
71
|
+
rubygems_version: 2.4.6
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Test helpers!
|