capybara-timeout_reporter 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/capybara-timeout_reporter.gemspec +1 -1
- data/lib/capybara/timeout_reporter.rb +10 -7
- 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: 12c6543ef86e3a77f0a6511c619f37f8aaf7d740
|
4
|
+
data.tar.gz: 0ed245bd57ae3264e67b9f34bdb20e111a9ca3ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 617862199f0d0225f13ad059d93b995d10bb5eb51e8a84b28ea8439b432d018dbb9d52f285b0ba5e3aa92820b27c273b51a79206c7509aac184e2c47cab62ef7
|
7
|
+
data.tar.gz: 6f15109092dd9d2410b79bf5e23df7ba846ffb1f29be46cd8425e4f22dcdd13404e55962fa70132c9be5c1d7698137dea853ac22b8c0e44c2b3b93c845c6d697
|
data/README.md
CHANGED
@@ -61,7 +61,7 @@ Default beviour, in case of Capybara sync timeout the following warning will be
|
|
61
61
|
|
62
62
|
```
|
63
63
|
# somewhere in your test_helper.rb, spec_helper.rb, evn.rb, etc.
|
64
|
-
Capybara::TimeoutReporter.on_timeout
|
64
|
+
Capybara::TimeoutReporter.on_timeout do |timeout_value, src_line|
|
65
65
|
# do whatever you want, for example:
|
66
66
|
# - raise an exception, if you want to make this strict
|
67
67
|
# - add an entry to test report, if you have one
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "capybara-timeout_reporter"
|
5
|
-
spec.version = "0.0.
|
5
|
+
spec.version = "0.0.5"
|
6
6
|
spec.authors = ["Vitalii Grygoruk"]
|
7
7
|
spec.email = ["vitaliy[dot]grigoruk[at]gmail[dot]com"]
|
8
8
|
spec.summary = %q{Detecting and reporting capybara sync timeouts}
|
@@ -2,17 +2,20 @@ require 'capybara'
|
|
2
2
|
|
3
3
|
module Capybara
|
4
4
|
class TimeoutReporter
|
5
|
-
@on_timeout = Proc.new do |seconds, src_line|
|
6
|
-
puts "[WARNING] Capybara find timed out after #{seconds} seconds in #{src_line}"
|
7
|
-
end
|
8
5
|
|
9
6
|
class << self
|
10
|
-
|
7
|
+
def on_timeout(&block)
|
8
|
+
@block = block
|
9
|
+
end
|
11
10
|
|
12
|
-
def
|
13
|
-
@
|
11
|
+
def report(seconds, src_line)
|
12
|
+
@block.call(seconds, src_line)
|
14
13
|
end
|
15
14
|
end
|
15
|
+
|
16
|
+
on_timeout do |seconds, src_line|
|
17
|
+
puts "[WARNING] Capybara find timed out after #{seconds} seconds in #{src_line}"
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
18
21
|
module Node
|
@@ -24,7 +27,7 @@ module Capybara
|
|
24
27
|
if Time.now-start_time > seconds
|
25
28
|
trace_line = Thread.current.backtrace.find { |l| !l.include?('gems/capybara') }
|
26
29
|
src_line = trace_line.match(/(.*):.*/).captures.first
|
27
|
-
Capybara::TimeoutReporter.
|
30
|
+
Capybara::TimeoutReporter.report(seconds, src_line)
|
28
31
|
end
|
29
32
|
raise e
|
30
33
|
end
|