rspec-pride 2.3.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +10 -3
- data/lib/rspec/pride.rb +69 -75
- data/spec/pride_spec.rb +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 997be400ee515e33ce564e8cd89353108d87c013
|
4
|
+
data.tar.gz: 2c56e306ce7ecdb4872622cf7549dcb6dd0dfe3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe072bc02c19c8e59ff5c1ab607c99e0599377b3dfd756929911fd28ab54348043e0a90a2f02369f7a93674686f2557c9709b186d69880d41868f306ee20fb9
|
7
|
+
data.tar.gz: 8e856a205ce45bb00f39ec447a2f81d69cbfa9b1e937d8898c17cea1320fe0f8c17f6b58b36e61bfa3efb3d71ac90f0138782138e24e61995518275b0b0a98f2
|
data/README.markdown
CHANGED
@@ -2,13 +2,16 @@
|
|
2
2
|
|
3
3
|
Take pride in your test output!
|
4
4
|
|
5
|
-
Mimics the functionality of minitest/pride for
|
5
|
+
Mimics the functionality of minitest/pride for RSpec 3
|
6
|
+
|
7
|
+
![Prideful Tests](https://github.com/ferrous26/rspec-pride/blob/master/resources/pride.png)
|
8
|
+
|
6
9
|
|
7
10
|
## How to use Rspec-pride
|
8
11
|
|
9
12
|
To use rspec-pride, you need to call `rspec` kind of like this:
|
10
13
|
|
11
|
-
rspec --require rspec/pride --format
|
14
|
+
rspec --require rspec/pride --format PrideFormatter
|
12
15
|
|
13
16
|
Or put those options in your `.rspec` file.
|
14
17
|
|
@@ -31,4 +34,8 @@ just as well in this case.
|
|
31
34
|
|
32
35
|
## Copyright
|
33
36
|
|
34
|
-
Copyright (c) 2011 Mark Rada. See LICENSE.txt for further details.
|
37
|
+
Copyright (c) 2011-2015 Mark Rada. See LICENSE.txt for further details.
|
38
|
+
|
39
|
+
|
40
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ferrous26/rspec-pride/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
41
|
+
|
data/lib/rspec/pride.rb
CHANGED
@@ -1,94 +1,88 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def example_passed example
|
19
|
-
output.print pass
|
20
|
-
end
|
21
|
-
|
22
|
-
def example_failed example
|
23
|
-
super
|
24
|
-
output.print failure
|
25
|
-
end
|
1
|
+
class PrideFormatter < RSpec::Core::Formatters::ProgressFormatter
|
2
|
+
attr_reader :output
|
3
|
+
RSpec::Core::Formatters.register self, :example_passed, :example_failed, :example_pending,
|
4
|
+
:dump_summary
|
5
|
+
|
6
|
+
## stolen from minitest/pride
|
7
|
+
ESC = "\e["
|
8
|
+
NND = "#{ESC}0m"
|
9
|
+
|
10
|
+
def initialize io
|
11
|
+
initialize_colors
|
12
|
+
@output = io
|
13
|
+
@index = 0
|
14
|
+
@size = @colors.size
|
15
|
+
output.print "\n"
|
16
|
+
end
|
26
17
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
18
|
+
def example_passed example
|
19
|
+
output.print pass
|
20
|
+
end
|
31
21
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
output.print "\n\n#{icing} in #{format_duration(duration)}\n" +
|
36
|
-
"#{example_count} examples, #{failure_count} failures, #{pending_count} pending\n\n"
|
37
|
-
end
|
22
|
+
def example_failed example
|
23
|
+
output.print failure
|
24
|
+
end
|
38
25
|
|
39
|
-
|
26
|
+
def example_pending example
|
27
|
+
output.print pending
|
28
|
+
end
|
40
29
|
|
41
|
-
|
42
|
-
|
43
|
-
|
30
|
+
def dump_summary(summary)
|
31
|
+
icing = 'Fabulous tests'.split(//).map {|x| rainbow x }.join
|
32
|
+
output.print "\n\n#{icing} in #{summary.formatted_duration}\n" +
|
33
|
+
"#{summary.example_count} examples, #{summary.failure_count} failures, #{summary.pending_count} pending\n\n"
|
34
|
+
end
|
44
35
|
|
45
|
-
|
36
|
+
private
|
46
37
|
|
47
|
-
|
38
|
+
def pass ; rainbow '.' ; end
|
39
|
+
def pending; "\e[40m\e[37mP#{NND}"; end
|
40
|
+
def failure; "\e[41m\e[37mF#{NND}"; end
|
48
41
|
|
49
|
-
|
50
|
-
def initialize_colors
|
51
|
-
# walk red, green, and blue around a circle separated by equal thirds.
|
52
|
-
#
|
53
|
-
# To visualize, type this into wolfram-alpha:
|
54
|
-
#
|
55
|
-
# plot (3*sin(x)+3), (3*sin(x+2*pi/3)+3), (3*sin(x+4*pi/3)+3)
|
42
|
+
if ENV['TERM'] =~ /^xterm(-256color)?$/
|
56
43
|
|
57
|
-
|
58
|
-
@colors = (0...(6 * 7)).map { |n|
|
59
|
-
n *= 1.0 / 6
|
60
|
-
r = (3 * Math.sin(n ) + 3).to_i
|
61
|
-
g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
|
62
|
-
b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
|
44
|
+
PI_3 = Math::PI / 3
|
63
45
|
|
64
|
-
|
65
|
-
|
66
|
-
|
46
|
+
# Taken, wholesale, from minitest/pride
|
47
|
+
def initialize_colors
|
48
|
+
# walk red, green, and blue around a circle separated by equal thirds.
|
49
|
+
#
|
50
|
+
# To visualize, type this into wolfram-alpha:
|
51
|
+
#
|
52
|
+
# plot (3*sin(x)+3), (3*sin(x+2*pi/3)+3), (3*sin(x+4*pi/3)+3)
|
67
53
|
|
68
|
-
|
69
|
-
|
70
|
-
|
54
|
+
# 6 has wide pretty gradients. 3 == lolcat, about half the width
|
55
|
+
@colors = (0...(6 * 7)).map { |n|
|
56
|
+
n *= 1.0 / 6
|
57
|
+
r = (3 * Math.sin(n ) + 3).to_i
|
58
|
+
g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
|
59
|
+
b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
|
71
60
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
"#{ESC}38;5;#{color}m#{string}#{NND}"
|
76
|
-
end
|
61
|
+
# Then we take rgb and encode them in a single number using base 6.
|
62
|
+
# For some mysterious reason, we add 16... to clear the bottom 4 bits?
|
63
|
+
# Yes... they're ugly.
|
77
64
|
|
78
|
-
|
65
|
+
36 * r + 6 * g + b + 16
|
66
|
+
}
|
67
|
+
end
|
79
68
|
|
80
|
-
|
81
|
-
|
82
|
-
|
69
|
+
def rainbow string
|
70
|
+
color = @colors[@index % @size]
|
71
|
+
@index += 1
|
72
|
+
"#{ESC}38;5;#{color}m#{string}#{NND}"
|
73
|
+
end
|
83
74
|
|
84
|
-
|
85
|
-
string = '*' if string == '.'
|
86
|
-
color = @colors[@index % @size]
|
87
|
-
@index += 1
|
88
|
-
"#{ESC}#{color}m#{string}#{NND}"
|
89
|
-
end
|
75
|
+
else # Old Low-Res Pride
|
90
76
|
|
77
|
+
def initialize_colors
|
78
|
+
@colors = (31..36).to_a
|
91
79
|
end
|
92
80
|
|
81
|
+
def rainbow string
|
82
|
+
string = '*' if string == '.'
|
83
|
+
color = @colors[@index % @size]
|
84
|
+
@index += 1
|
85
|
+
"#{ESC}#{color}m#{string}#{NND}"
|
86
|
+
end
|
93
87
|
end
|
94
88
|
end
|
data/spec/pride_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe 'Some class' do
|
|
12
12
|
|
13
13
|
50.times do |n|
|
14
14
|
it "passes #{n}" do
|
15
|
-
1.
|
15
|
+
expect(1).to eq 1
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -24,13 +24,13 @@ describe 'Some class' do
|
|
24
24
|
end
|
25
25
|
else
|
26
26
|
it 'should fail' do
|
27
|
-
1.
|
27
|
+
expect(1).to eq 0
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
10.times do |n|
|
32
32
|
it "passed #{n}" do
|
33
|
-
true.
|
33
|
+
expect(true).to eq true
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-pride
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -16,15 +16,15 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
description: Mimics the functionality of minitest/pride for
|
26
|
+
version: '3.0'
|
27
|
+
description: Mimics the functionality of minitest/pride for RSpec3
|
28
28
|
email: mrada@marketcircle.com
|
29
29
|
executables: []
|
30
30
|
extensions: []
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.4.3
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Take pride in your testing
|