parallel_rspec_progress 0.1.1 → 0.1.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a945ab8eadd896eef539852a30db052fe204f9731807b5b14962fc5bf692c348
|
4
|
+
data.tar.gz: fa880a599f57be5ae5ef7639b1522a49df636d3e6e6f07092fa5494104ae5ebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 571aca6b5383e656433f5695c2d07ab86eea7ef58a0d55e2b9bd2c9d5cb96632935ea46de41551c87b9492f6ee38ee7b0a88f44801b90a849691abce1f686de2
|
7
|
+
data.tar.gz: bfa9e1fda8ad295db24f187aaeea22bbc7d591e1e7680ae3fcaee171fb3439673af2fec76ad0d37d18cd6656dd433984e0dad261be430f4776bfd1b304a6901c
|
@@ -3,24 +3,55 @@ require "drb/drb"
|
|
3
3
|
|
4
4
|
module ParallelRspecProgress
|
5
5
|
class Controller
|
6
|
-
|
6
|
+
def initialize
|
7
|
+
@failed = []
|
8
|
+
@passed = []
|
9
|
+
@pending = []
|
10
|
+
@total = 0
|
11
|
+
end
|
7
12
|
|
8
13
|
def stop
|
9
14
|
DRb.stop_service
|
10
15
|
end
|
11
16
|
|
12
|
-
def
|
13
|
-
@progressbar
|
17
|
+
def put_total(val)
|
18
|
+
if @progressbar
|
19
|
+
@total += val
|
20
|
+
@progressbar.total = @total
|
21
|
+
else
|
22
|
+
@total = val
|
23
|
+
create_progressbar
|
24
|
+
end
|
14
25
|
end
|
15
26
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
def add(key:, item:)
|
28
|
+
case key
|
29
|
+
when :failed
|
30
|
+
@failed << item
|
31
|
+
when :passed
|
32
|
+
@passed << item
|
33
|
+
when :pending
|
34
|
+
@pending << item
|
35
|
+
end
|
36
|
+
|
37
|
+
@progressbar.increment
|
38
|
+
@progressbar.title = compose_title
|
24
39
|
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def create_progressbar
|
44
|
+
@progressbar = ProgressBar.create(
|
45
|
+
format: "%a %e %P% Processed: %c from %C %b\u{15E7}%i %p%% %t",
|
46
|
+
progress_mark: ' ',
|
47
|
+
remainder_mark: "\u{FF65}",
|
48
|
+
starting_at: 0,
|
49
|
+
total: @total
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def compose_title
|
54
|
+
"passed: #{@passed.count} failed: #{@failed.count} pending: #{@pending.count}"
|
55
|
+
end
|
25
56
|
end
|
26
57
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "parallel_tests"
|
2
|
+
require "drb/drb"
|
3
3
|
|
4
4
|
class ParallelProgressFormatter
|
5
5
|
RSpec::Core::Formatters.register self,
|
@@ -17,11 +17,7 @@ class ParallelProgressFormatter
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def start(notification)
|
20
|
-
|
21
|
-
controller.progressbar.total += notification.count
|
22
|
-
else
|
23
|
-
controller.create_progressbar(notification.count)
|
24
|
-
end
|
20
|
+
controller.put_total(notification.count)
|
25
21
|
end
|
26
22
|
|
27
23
|
def close(notification)
|
@@ -33,14 +29,14 @@ class ParallelProgressFormatter
|
|
33
29
|
end
|
34
30
|
|
35
31
|
def example_passed(notification)
|
36
|
-
controller.
|
32
|
+
controller.add(key: :passed, item: 1)
|
37
33
|
end
|
38
34
|
|
39
35
|
def example_failed(notification)
|
40
|
-
controller.
|
36
|
+
controller.add(key: :failed, item: 1)
|
41
37
|
end
|
42
38
|
|
43
39
|
def example_pending(notification)
|
44
|
-
controller.
|
40
|
+
controller.add(key: :pending, item: 1)
|
45
41
|
end
|
46
42
|
end
|