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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b0609f1d759deca673aa0eca7f925fb68f43af4
4
- data.tar.gz: 0292bc7fc4d3c36f03d07f397867d6997ac929af
3
+ metadata.gz: 997be400ee515e33ce564e8cd89353108d87c013
4
+ data.tar.gz: 2c56e306ce7ecdb4872622cf7549dcb6dd0dfe3a
5
5
  SHA512:
6
- metadata.gz: 2cd394dface55fc696665ecf1127cc0dc0641ed66c58e8deca84a7f1f2517064e269dd82f28d4f3f6ca4961350805b9a8c970224258acb0d05d28091e1aaaabe
7
- data.tar.gz: d8c42111bca4856c04f15bebccf77d785119626cbb21b0b87d69999d50e67833afde551d284f4eb15aea13784e771b44f15a96f1fb87c53027df32d200c4c9d6
6
+ metadata.gz: ebe072bc02c19c8e59ff5c1ab607c99e0599377b3dfd756929911fd28ab54348043e0a90a2f02369f7a93674686f2557c9709b186d69880d41868f306ee20fb9
7
+ data.tar.gz: 8e856a205ce45bb00f39ec447a2f81d69cbfa9b1e937d8898c17cea1320fe0f8c17f6b58b36e61bfa3efb3d71ac90f0138782138e24e61995518275b0b0a98f2
@@ -2,13 +2,16 @@
2
2
 
3
3
  Take pride in your test output!
4
4
 
5
- Mimics the functionality of minitest/pride for RSpec2
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 RSpec::Pride
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
+
@@ -1,94 +1,88 @@
1
- require 'rspec/core/formatters/base_text_formatter'
2
-
3
- module RSpec
4
- class Pride < RSpec::Core::Formatters::BaseTextFormatter
5
-
6
- # stolen from minitest/pride
7
- ESC = "\e["
8
- NND = "#{ESC}0m"
9
-
10
- def initialize io
11
- super
12
- initialize_colors
13
- @index = 0
14
- @size = @colors.size
15
- output.print "\n"
16
- end
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
- def example_pending example
28
- super
29
- output.print pending
30
- end
18
+ def example_passed example
19
+ output.print pass
20
+ end
31
21
 
32
- def dump_summary duration, example_count, failure_count, pending_count
33
- dump_profile if profile_examples? && failure_count == 0
34
- icing = 'Fabulous tests'.split(//).map { |x| rainbow x }.join
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
- private
26
+ def example_pending example
27
+ output.print pending
28
+ end
40
29
 
41
- def pass ; rainbow '.' ; end
42
- def pending; "\e[40m\e[37mP#{NND}"; end
43
- def failure; "\e[41m\e[37mF#{NND}"; end
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
- if ENV['TERM'] =~ /^xterm(-256color)?$/
36
+ private
46
37
 
47
- PI_3 = Math::PI / 3
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
- # Taken, wholesale, from minitest/pride
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
- # 6 has wide pretty gradients. 3 == lolcat, about half the width
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
- # Then we take rgb and encode them in a single number using base 6.
65
- # For some mysterious reason, we add 16... to clear the bottom 4 bits?
66
- # Yes... they're ugly.
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
- 36 * r + 6 * g + b + 16
69
- }
70
- end
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
- def rainbow string
73
- color = @colors[@index % @size]
74
- @index += 1
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
- else # Old Low-Res Pride
65
+ 36 * r + 6 * g + b + 16
66
+ }
67
+ end
79
68
 
80
- def initialize_colors
81
- @colors = (31..36).to_a
82
- end
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
- def rainbow string
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
@@ -12,7 +12,7 @@ describe 'Some class' do
12
12
 
13
13
  50.times do |n|
14
14
  it "passes #{n}" do
15
- 1.should == 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.should == 0
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.should be_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: 2.3.0
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: 2014-01-10 00:00:00.000000000 Z
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: '2.10'
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: '2.10'
27
- description: Mimics the functionality of minitest/pride for RSpec2
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.2.0
58
+ rubygems_version: 2.4.3
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: Take pride in your testing