test-helpers 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/lib/test-helpers/wait/wait.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 737258463f16df120cd872f36c0466b389ef46a1
|
4
|
+
data.tar.gz: db1a32a18d91af7f1ff88d0a5ca8a6198191860f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fbd2c055037b712da3d64a7c8adff16a564915ca77cd6d71f532ebae9da1f9e48707f367a4746404fc6810ebdbbdfc747f4fc5d8aec1d4e47a27dc1996cf799
|
7
|
+
data.tar.gz: c1c69ac59fdbd9a1714102e8169fcca1e8a36326fe1c21cee4d23491f3bfb00f89f289a03c0b7ff84a9c43997789a3808933e0fd38b401fa812e713b3cd15b0c
|
@@ -13,12 +13,12 @@ module TestHelpers
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class Configuration
|
16
|
-
attr_accessor :wait_timeout, :wait_interval, :
|
16
|
+
attr_accessor :wait_timeout, :wait_interval, :error_message
|
17
17
|
|
18
18
|
def initialize
|
19
19
|
@wait_timeout = 5.0
|
20
20
|
@wait_interval = 0.1
|
21
|
-
@
|
21
|
+
@error_message = 'Timed out waiting for block'
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -44,7 +44,7 @@ module TestHelpers
|
|
44
44
|
return unless block_given?
|
45
45
|
timeout = Float(options[:timeout] || TestHelpers::Wait.configuration.wait_timeout)
|
46
46
|
interval = Float(options[:interval] || TestHelpers::Wait.configuration.wait_interval)
|
47
|
-
|
47
|
+
error_message = options[:error_message] || TestHelpers::Wait.configuration.error_message
|
48
48
|
end_time = ::Time.now + timeout
|
49
49
|
until ::Time.now > end_time
|
50
50
|
begin
|
@@ -56,7 +56,7 @@ module TestHelpers
|
|
56
56
|
end
|
57
57
|
result = yield
|
58
58
|
return result if result
|
59
|
-
raise
|
59
|
+
raise TimeoutError.new(error_message)
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|