rainbow_documentation 0.0.1 → 0.0.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 +4 -4
- data/lib/rainbow_documentation/version.rb +2 -2
- data/lib/rainbow_documentation.rb +13 -11
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39b333b990bfecfd211418e183d86ba4e6d0d6a4
|
|
4
|
+
data.tar.gz: dd1915e49be1a4fa2ea99633fe2244ed2dfb9a26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be161e3a60a1b0c7042c33e8376f520b05d81c9baaab796aa98221fe56b5a3ce6a9806539c88bbc19c0f9f485a685e4dd629c01cf1ddcb348ea1223225d29cc7
|
|
7
|
+
data.tar.gz: a264fd17c85274d43e82213e5d86049a37023e3c815c5c4d5e53b6e6f768724542799e5cb111598093d08d0eac02879732fd34ae9e829b42f359784c58d1a6d8
|
|
@@ -16,9 +16,15 @@ class RainbowDocumentation < RSpec::Core::Formatters::BaseTextFormatter
|
|
|
16
16
|
96, #:light_cyan
|
|
17
17
|
35, #:magenta
|
|
18
18
|
95, #:light_magenta
|
|
19
|
-
37
|
|
19
|
+
37 #:light_white]
|
|
20
20
|
].freeze
|
|
21
21
|
|
|
22
|
+
TEST_COLOR = {
|
|
23
|
+
fail: 31, # red
|
|
24
|
+
success: 32, # green
|
|
25
|
+
pending: 33, # yellow
|
|
26
|
+
}.freeze
|
|
27
|
+
|
|
22
28
|
def initialize(output)
|
|
23
29
|
super
|
|
24
30
|
@output = output
|
|
@@ -26,7 +32,7 @@ class RainbowDocumentation < RSpec::Core::Formatters::BaseTextFormatter
|
|
|
26
32
|
end
|
|
27
33
|
|
|
28
34
|
def example_group_started(notification)
|
|
29
|
-
@output.puts wrap("#{current_indentation}#{notification.group.description.strip}", @group_level)
|
|
35
|
+
@output.puts wrap("#{current_indentation}#{notification.group.description.strip}", COLOR[@group_level])
|
|
30
36
|
@group_level += 1
|
|
31
37
|
end
|
|
32
38
|
|
|
@@ -49,19 +55,15 @@ class RainbowDocumentation < RSpec::Core::Formatters::BaseTextFormatter
|
|
|
49
55
|
private
|
|
50
56
|
|
|
51
57
|
def passed_output(example)
|
|
52
|
-
|
|
53
|
-
:success)
|
|
58
|
+
wrap("#{current_indentation}#{example.description.strip}", TEST_COLOR[:success])
|
|
54
59
|
end
|
|
55
60
|
|
|
56
61
|
def pending_output(example, message)
|
|
57
|
-
|
|
58
|
-
:pending)
|
|
62
|
+
wrap("#{current_indentation}#{example.description.strip} (PENDING: #{message})", TEST_COLOR[:pending])
|
|
59
63
|
end
|
|
60
64
|
|
|
61
65
|
def failure_output(example, _exception)
|
|
62
|
-
|
|
63
|
-
"(FAILED - #{next_failure_index})",
|
|
64
|
-
:failure)
|
|
66
|
+
wrap("#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})", TEST_COLOR[:fail])
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
def next_failure_index
|
|
@@ -70,12 +72,12 @@ class RainbowDocumentation < RSpec::Core::Formatters::BaseTextFormatter
|
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
def current_indentation
|
|
73
|
-
' ' * @group_level
|
|
75
|
+
(' ' * 2) * @group_level
|
|
74
76
|
end
|
|
75
77
|
|
|
76
78
|
def wrap(text, code)
|
|
77
79
|
if RSpec.configuration.color_enabled?
|
|
78
|
-
"\e[#{
|
|
80
|
+
"\e[#{code}m#{text}\e[0m"
|
|
79
81
|
else
|
|
80
82
|
text
|
|
81
83
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rainbow_documentation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrea Capri
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|