parallel_formatter 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parallel_formatter/version.rb +1 -1
- data/lib/parallel_formatter.rb +56 -58
- 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: 7b7cf01a1d5143efcb0a115f39e2d1ad942e41e9
|
4
|
+
data.tar.gz: f74933aaa5dd140ce2b9a1197138b447b4a8c1d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f60ebbeaab3b1c47d41e70f4b11ebf0662ee5965421f7e389a8524cd29dca8d736c6b5af2f14616bf17cd16d06b3459d824ea92674e529f1b680fe0503647a6
|
7
|
+
data.tar.gz: 238c725c44843bfdc8d331ce6e2bc664c50c048678555a4a7286ed9f86fda5d88fd0bf738204ef51f6b86bc58b4287ade905f979b9ad003cb316248b1624f11f
|
data/lib/parallel_formatter.rb
CHANGED
@@ -1,74 +1,72 @@
|
|
1
1
|
require "parallel_formatter/version"
|
2
2
|
require 'rspec/core/formatters/base_text_formatter'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
:example_failed
|
4
|
+
class ParallelFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
5
|
+
RSpec::Core::Formatters.register self, :example_group_started, :example_started,
|
6
|
+
:example_passed, :example_pending,
|
7
|
+
:example_failed
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
def initialize(output)
|
10
|
+
super
|
11
|
+
@failed_examples = []
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def example_group_started(notification)
|
15
|
+
output.puts "GROUP STARTED: #{notification.group.description.strip}"
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def example_started(notification)
|
19
|
+
output.puts "TEST STARTED: #{notification.example.location}: " \
|
20
|
+
"#{notification.example.description}"
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
def example_passed(passed)
|
24
|
+
output.puts passed_output(passed.example)
|
25
|
+
end
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
def example_pending(pending)
|
28
|
+
output.puts pending_output(pending.example,
|
29
|
+
pending.example.execution_result.pending_message)
|
30
|
+
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
def example_failed(failure)
|
33
|
+
@failed_examples << failure.example
|
34
|
+
output.puts failure_output(failure.example,
|
35
|
+
failure.example.execution_result.exception)
|
36
|
+
output.puts failure.fully_formatted(@failed_examples.size)
|
37
|
+
end
|
39
38
|
|
40
|
-
|
39
|
+
private
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
def passed_output(example)
|
42
|
+
RSpec::Core::Formatters::ConsoleCodes.wrap(
|
43
|
+
'TEST PASSED: ' \
|
44
|
+
"#{example.location}: " \
|
45
|
+
" #{example.description.strip}",
|
46
|
+
:success
|
47
|
+
)
|
48
|
+
end
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
def pending_output(example, message)
|
51
|
+
RSpec::Core::Formatters::ConsoleCodes.wrap(
|
52
|
+
'TEST PENDING: ' \
|
53
|
+
"#{example.location}: " \
|
54
|
+
"#{example.description.strip} (PENDING: #{message})",
|
55
|
+
:pending
|
56
|
+
)
|
57
|
+
end
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
def failure_output(example, _exception)
|
60
|
+
RSpec::Core::Formatters::ConsoleCodes.wrap(
|
61
|
+
'TEST FAILED: ' \
|
62
|
+
"#{example.location}: " \
|
63
|
+
"#{example.description.strip} (FAILED - #{next_failure_index})",
|
64
|
+
:failure
|
65
|
+
)
|
66
|
+
end
|
68
67
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
68
|
+
def next_failure_index
|
69
|
+
@next_failure_index ||= 0
|
70
|
+
@next_failure_index += 1
|
73
71
|
end
|
74
72
|
end
|