rspec-rainbow 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +8 -2
- data/lib/rainbow.rb +15 -4
- data/rspec-rainbow.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 49ad1ad6aee4e7bffe52e490e0a1ee8d97d8c5f8
|
4
|
-
data.tar.gz: 85266145f4c3ed884e26566e492939c064d37fc8
|
5
2
|
SHA512:
|
6
|
-
|
7
|
-
|
3
|
+
data.tar.gz: 3f459826b3f09cb453733ac7955bf1cd72940f8ff73a9fc590381ab4d5c56e26915de8af20cad0bef17ef104b4e3a7a3caa794f5730ad684ebb4d764741c2afb
|
4
|
+
metadata.gz: 58c62accc8703178c988e7d72d7388f55466f53182c9444dfd0f02254e279e7b11cb534eec0d1d4998c6842f9a19a96b60833382b16267b4186decf104557442
|
5
|
+
SHA1:
|
6
|
+
data.tar.gz: 6d84c449069d648f058d7d8925aedd8618c43db9
|
7
|
+
metadata.gz: a202dad71d250869a657cefdbf9149ea9d7769d5
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# rspec-rainbow
|
2
2
|
|
3
|
-
|
3
|
+
Adds some color to your rspec tests!
|
4
|
+
|
5
|
+
Created because I was jealous of how beautiful [Minitest's](https://github.com/seattlerb/minitest) output is.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -10,7 +12,7 @@ Add this line to your application's Gemfile:
|
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
13
|
-
$ bundle
|
15
|
+
$ bundle install
|
14
16
|
|
15
17
|
Or install it yourself as:
|
16
18
|
|
@@ -31,3 +33,7 @@ If you want to use Rainbow by default, add it to your ```.rspec``` file.
|
|
31
33
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
34
|
4. Push to the branch (`git push origin my-new-feature`)
|
33
35
|
5. Create new Pull Request
|
36
|
+
|
37
|
+
## Attribution
|
38
|
+
|
39
|
+
Based on [Minitest's](https://github.com/seattlerb/minitest) Pride plugin
|
data/lib/rainbow.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
require 'rspec/core/formatters/progress_formatter'
|
2
2
|
|
3
3
|
class Rainbow < ::RSpec::Core::Formatters::ProgressFormatter
|
4
|
-
|
4
|
+
PI_3 = Math::PI / 3
|
5
|
+
|
5
6
|
def initialize(options)
|
6
|
-
|
7
|
+
# colors calculation stolen from Minitest's Pride Plugin
|
8
|
+
# https://github.com/seattlerb/minitest
|
9
|
+
@colors = (0...(6 * 7)).map { |n|
|
10
|
+
n *= 1.0 / 6
|
11
|
+
r = (3 * Math.sin(n ) + 3).to_i
|
12
|
+
g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
|
13
|
+
b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
|
14
|
+
|
15
|
+
36 * r + 6 * g + b + 16
|
16
|
+
}
|
7
17
|
@color_index = 0
|
8
18
|
super(options)
|
9
19
|
end
|
@@ -14,11 +24,12 @@ class Rainbow < ::RSpec::Core::Formatters::ProgressFormatter
|
|
14
24
|
end
|
15
25
|
|
16
26
|
def color(text, color_code)
|
17
|
-
|
27
|
+
color_code = rainbow if text == '.'
|
28
|
+
super
|
18
29
|
end
|
19
30
|
|
20
31
|
def color_code_for(code_or_symbol)
|
21
|
-
return code_or_symbol if code_or_symbol.is_a?(Integer)
|
32
|
+
return "38;5;#{code_or_symbol}" if code_or_symbol.is_a?(Integer)
|
22
33
|
super
|
23
34
|
end
|
24
35
|
|
data/rspec-rainbow.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rspec-rainbow"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.3"
|
8
8
|
spec.authors = ["Mike Coutermarsh"]
|
9
9
|
spec.email = ["coutermarsh.mike@gmail.com"]
|
10
10
|
spec.description = %q{the rainbow formatter for RSpec}
|