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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa58903a3711010f6212d27aadb0b7b64a1d942a
4
- data.tar.gz: 006311a6bd1c919457e3b6db6653070c43379c05
3
+ metadata.gz: 39b333b990bfecfd211418e183d86ba4e6d0d6a4
4
+ data.tar.gz: dd1915e49be1a4fa2ea99633fe2244ed2dfb9a26
5
5
  SHA512:
6
- metadata.gz: 34d783590e41596ee9189f557b4d46ea657e425d9b005448724652c5b4817bc1037445bf364285bc5f43866144458bf1f2bd320314788f41105b05ddcd11078d
7
- data.tar.gz: 39e588bca4aa2866f079c04f7c22028630096c047e817c9449a91a0f2b9ccd0e3548081b56d6085f8ef4b33942ab7c59afeff8ba9bbd8c0d66dba593499e30f1
6
+ metadata.gz: be161e3a60a1b0c7042c33e8376f520b05d81c9baaab796aa98221fe56b5a3ce6a9806539c88bbc19c0f9f485a685e4dd629c01cf1ddcb348ea1223225d29cc7
7
+ data.tar.gz: a264fd17c85274d43e82213e5d86049a37023e3c815c5c4d5e53b6e6f768724542799e5cb111598093d08d0eac02879732fd34ae9e829b42f359784c58d1a6d8
@@ -1,4 +1,4 @@
1
1
  class RainbowDocumentation
2
- VERSION = '0.0.1'.freeze
3
- RELEASE_DATE = '2016-04-26'.freeze
2
+ VERSION = '0.0.2'.freeze
3
+ RELEASE_DATE = '2016-05-05'.freeze
4
4
  end
@@ -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 #:light_white]
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
- RSpec::Core::Formatters::ConsoleCodes.wrap("#{current_indentation} -> #{example.description.strip}",
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
- RSpec::Core::Formatters::ConsoleCodes.wrap("#{current_indentation} -> #{example.description.strip} (PENDING: #{message})",
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
- RSpec::Core::Formatters::ConsoleCodes.wrap("#{current_indentation} -> #{example.description.strip} " \
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[#{COLOR[code]}m#{text}\e[0m"
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.1
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-04-26 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake