rspec-rainbow 0.1.0 → 0.2.0
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/.gitignore +1 -0
- data/README.md +20 -14
- data/Rakefile +1 -1
- data/lib/rainbow.rb +9 -36
- data/lib/rainbow_formatter/rspec2.rb +35 -0
- data/lib/rainbow_formatter/rspec3.rb +31 -0
- data/rspec-rainbow.gemspec +13 -12
- metadata +39 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e5580e1dc12145309a76f49f6fbf45166d96694
|
4
|
+
data.tar.gz: 0c9130b9d896c5f0082f3a05eb19cfd6e27bb110
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c7181207becf91cd0e8657dd5f22c1a2efbf6e546ccd234063eda09d3163a5f8035094fbbcab3f37cedbba1d06c564e357c850c71e6c0efb76850239f879e97
|
7
|
+
data.tar.gz: a48523f5e8c1a00968438252303c6e2a16278a17c6b7f314c2ca30f2cf5458977d6d3d44f4d958b78ce74f01889a4f51558af5b540d2eec5677c6cf5257c80d9
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,18 @@
|
|
1
|
-
# rspec-rainbow
|
1
|
+
# rspec-rainbow :rainbow:
|
2
|
+
[](https://badge.fury.io/rb/rspec-rainbow)
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
Created because I was jealous of how beautiful [Minitest's](https://github.com/seattlerb/minitest) output is.
|
5
|
+
Add some pride to your rspec tests!
|
6
6
|
|
7
|
+
<img src="https://raw.githubusercontent.com/mscoutermarsh/rspec-rainbow/master/rspec-rainbow-screenshot.png" alt="rspec rainbow" width="500">
|
7
8
|
## Installation
|
8
9
|
|
9
10
|
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
```ruby
|
12
|
+
group :test do
|
13
|
+
gem 'rspec-rainbow'
|
14
|
+
end
|
15
|
+
```
|
13
16
|
And then execute:
|
14
17
|
|
15
18
|
$ bundle install
|
@@ -28,12 +31,15 @@ If you want to use Rainbow by default, add it to your ```.rspec``` file.
|
|
28
31
|
|
29
32
|
## Contributing
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mscoutermarsh/rspec-rainbow. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct.
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
39
|
+
|
40
|
+
## Attribution :sparkling_heart:
|
36
41
|
|
37
|
-
|
42
|
+
Based on [Minitest's](https://github.com/seattlerb/minitest) Pride plugin
|
38
43
|
|
39
|
-
|
44
|
+
## For Help:
|
45
|
+
Tweet [@mscccc](https://twitter.com/mscccc) or open an issue.
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
data/lib/rainbow.rb
CHANGED
@@ -1,36 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
}
|
17
|
-
@color_index = 0
|
18
|
-
super(options)
|
19
|
-
end
|
20
|
-
|
21
|
-
def rainbow
|
22
|
-
@color_index == (@colors.size - 1) ? @color_index = 0 : @color_index += 1
|
23
|
-
@colors[@color_index]
|
24
|
-
end
|
25
|
-
|
26
|
-
def color(text, color_code)
|
27
|
-
color_code = rainbow if text == '.'
|
28
|
-
super
|
29
|
-
end
|
30
|
-
|
31
|
-
def color_code_for(code_or_symbol)
|
32
|
-
return "38;5;#{code_or_symbol}" if code_or_symbol.is_a?(Integer)
|
33
|
-
super
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
1
|
+
if Gem::Version.new(RSpec::Core::Version::STRING).release >= Gem::Version.new('3.1.0')
|
2
|
+
require 'rainbow_formatter/rspec3'
|
3
|
+
formatter = RSpec3
|
4
|
+
else
|
5
|
+
require 'rainbow_formatter/rspec2'
|
6
|
+
formatter = RSpec2
|
7
|
+
end
|
8
|
+
|
9
|
+
Rainbow = formatter
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rspec/core/formatters/progress_formatter'
|
2
|
+
|
3
|
+
class RSpec2 < ::RSpec::Core::Formatters::ProgressFormatter
|
4
|
+
PI_3 = Math::PI / 3
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
# colors calculation stolen from Minitest's Pride Plugin
|
8
|
+
# https://github.com/seattlerb/minitest
|
9
|
+
@colors = (0...(6 * 7)).map do |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
|
+
end
|
17
|
+
@color_index = 0
|
18
|
+
super(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def rainbow
|
22
|
+
@color_index == (@colors.size - 1) ? @color_index = 0 : @color_index += 1
|
23
|
+
@colors[@color_index]
|
24
|
+
end
|
25
|
+
|
26
|
+
def color(text, color_code)
|
27
|
+
color_code = rainbow if text == '.'
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def color_code_for(code_or_symbol)
|
32
|
+
return "38;5;#{code_or_symbol}" if code_or_symbol.is_a?(Integer)
|
33
|
+
super
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
RSpec::Support.require_rspec_core 'formatters/base_text_formatter'
|
2
|
+
|
3
|
+
class RSpec3 < RSpec::Core::Formatters::BaseTextFormatter
|
4
|
+
RSpec::Core::Formatters.register self, :example_passed, :initialize
|
5
|
+
|
6
|
+
PI_3 = Math::PI / 3
|
7
|
+
|
8
|
+
def initialize(options)
|
9
|
+
# colors calculation stolen from Minitest's Pride Plugin
|
10
|
+
# https://github.com/seattlerb/minitest
|
11
|
+
@colors = (0...(6 * 7)).map do |n|
|
12
|
+
n *= 1.0 / 6
|
13
|
+
r = (3 * Math.sin(n) + 3).to_i
|
14
|
+
g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
|
15
|
+
b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
|
16
|
+
|
17
|
+
36 * r + 6 * g + b + 16
|
18
|
+
end
|
19
|
+
@color_index = 0
|
20
|
+
super(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def example_passed(_notification)
|
24
|
+
output.print "\e[38;5;#{rainbow}m.\e[0m"
|
25
|
+
end
|
26
|
+
|
27
|
+
def rainbow
|
28
|
+
@color_index == (@colors.size - 1) ? @color_index = 0 : @color_index += 1
|
29
|
+
@colors[@color_index]
|
30
|
+
end
|
31
|
+
end
|
data/rspec-rainbow.gemspec
CHANGED
@@ -3,21 +3,22 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
7
|
-
spec.version =
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
10
|
-
spec.description =
|
11
|
-
spec.summary =
|
12
|
-
spec.homepage =
|
13
|
-
spec.license =
|
6
|
+
spec.name = 'rspec-rainbow'
|
7
|
+
spec.version = '0.2.0'
|
8
|
+
spec.authors = ['Mike Coutermarsh']
|
9
|
+
spec.email = ['coutermarsh.mike@gmail.com']
|
10
|
+
spec.description = 'the rainbow progress formatter for RSpec'
|
11
|
+
spec.summary = 'RSpec rainbow formatter'
|
12
|
+
spec.homepage = 'https://github.com/mscoutermarsh/rspec-rainbow'
|
13
|
+
spec.license = 'MIT'
|
14
14
|
|
15
|
-
spec.files = [
|
15
|
+
spec.files = ['.gitignore', 'Gemfile', 'LICENSE', 'README.md', 'Rakefile', 'lib/rainbow.rb', 'lib/rainbow_formatter/rspec2.rb', 'lib/rainbow_formatter/rspec3.rb', 'rspec-rainbow.gemspec']
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = [
|
18
|
+
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_dependency 'rspec',
|
21
|
-
spec.add_development_dependency
|
20
|
+
spec.add_dependency 'rspec', '>= 2.14.0', '>= 2.99', '< 4'
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
22
|
spec.add_development_dependency 'rake', '~> 0'
|
23
|
+
spec.add_development_dependency 'rubocop', '~> 0.35'
|
23
24
|
end
|
metadata
CHANGED
@@ -1,63 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rainbow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Coutermarsh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.14.0
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: '2.99'
|
23
|
+
- - "<"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '4'
|
23
26
|
type: :runtime
|
24
27
|
prerelease: false
|
25
28
|
version_requirements: !ruby/object:Gem::Requirement
|
26
29
|
requirements:
|
27
|
-
- -
|
30
|
+
- - ">="
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: 2.14.0
|
30
|
-
- -
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '2.99'
|
36
|
+
- - "<"
|
31
37
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
38
|
+
version: '4'
|
33
39
|
- !ruby/object:Gem::Dependency
|
34
40
|
name: bundler
|
35
41
|
requirement: !ruby/object:Gem::Requirement
|
36
42
|
requirements:
|
37
|
-
- - ~>
|
43
|
+
- - "~>"
|
38
44
|
- !ruby/object:Gem::Version
|
39
45
|
version: '1.3'
|
40
46
|
type: :development
|
41
47
|
prerelease: false
|
42
48
|
version_requirements: !ruby/object:Gem::Requirement
|
43
49
|
requirements:
|
44
|
-
- - ~>
|
50
|
+
- - "~>"
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: '1.3'
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: rake
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
50
56
|
requirements:
|
51
|
-
- - ~>
|
57
|
+
- - "~>"
|
52
58
|
- !ruby/object:Gem::Version
|
53
59
|
version: '0'
|
54
60
|
type: :development
|
55
61
|
prerelease: false
|
56
62
|
version_requirements: !ruby/object:Gem::Requirement
|
57
63
|
requirements:
|
58
|
-
- - ~>
|
64
|
+
- - "~>"
|
59
65
|
- !ruby/object:Gem::Version
|
60
66
|
version: '0'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rubocop
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0.35'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0.35'
|
61
81
|
description: the rainbow progress formatter for RSpec
|
62
82
|
email:
|
63
83
|
- coutermarsh.mike@gmail.com
|
@@ -65,12 +85,14 @@ executables: []
|
|
65
85
|
extensions: []
|
66
86
|
extra_rdoc_files: []
|
67
87
|
files:
|
68
|
-
- .gitignore
|
88
|
+
- ".gitignore"
|
69
89
|
- Gemfile
|
70
90
|
- LICENSE
|
71
91
|
- README.md
|
72
92
|
- Rakefile
|
73
93
|
- lib/rainbow.rb
|
94
|
+
- lib/rainbow_formatter/rspec2.rb
|
95
|
+
- lib/rainbow_formatter/rspec3.rb
|
74
96
|
- rspec-rainbow.gemspec
|
75
97
|
homepage: https://github.com/mscoutermarsh/rspec-rainbow
|
76
98
|
licenses:
|
@@ -82,18 +104,19 @@ require_paths:
|
|
82
104
|
- lib
|
83
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
106
|
requirements:
|
85
|
-
- -
|
107
|
+
- - ">="
|
86
108
|
- !ruby/object:Gem::Version
|
87
109
|
version: '0'
|
88
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
111
|
requirements:
|
90
|
-
- -
|
112
|
+
- - ">="
|
91
113
|
- !ruby/object:Gem::Version
|
92
114
|
version: '0'
|
93
115
|
requirements: []
|
94
116
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.4.8
|
96
118
|
signing_key:
|
97
119
|
specification_version: 4
|
98
120
|
summary: RSpec rainbow formatter
|
99
121
|
test_files: []
|
122
|
+
has_rdoc:
|