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