minitest-display 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,5 +3,5 @@ source "http://rubygems.org"
3
3
  group :development do
4
4
  gem "bundler", "~> 1.0.0"
5
5
  gem "jeweler", "~> 1.5.2"
6
- gem "minitest", "2.0.2"
6
+ gem "minitest"
7
7
  end
data/Gemfile.lock CHANGED
@@ -6,8 +6,8 @@ GEM
6
6
  bundler (~> 1.0.0)
7
7
  git (>= 1.2.5)
8
8
  rake
9
- minitest (2.0.2)
10
- rake (0.8.7)
9
+ minitest (2.3.1)
10
+ rake (0.9.2)
11
11
 
12
12
  PLATFORMS
13
13
  ruby
@@ -15,4 +15,4 @@ PLATFORMS
15
15
  DEPENDENCIES
16
16
  bundler (~> 1.0.0)
17
17
  jeweler (~> 1.5.2)
18
- minitest (= 2.0.2)
18
+ minitest
@@ -1,20 +1,20 @@
1
- = minitest-display
1
+ # minitest-display
2
2
 
3
- MiniTest::Display is a module that monkey patches a lot of the MiniTest::Unit interals to allow for configurable display options.
3
+ MiniTest::Display is a module that monkey patches a lot of the MiniTest::Unit internals to allow for configurable display options.
4
4
  You want color?! You want Suite name printouts?!?! You want fried eggs?! Too bad.
5
5
 
6
- I was messing with leftright (https://github.com/jordi/leftright - which is awesome btw) and trying to get it to work well with 1.9 but its all tied up in Test::Unit.
6
+ I was messing with [leftright](https://github.com/jordi/leftright) (which is awesome btw) and trying to get it to work well with 1.9 but its all tied up in Test::Unit.
7
7
  MiniTest is much much simpler, and its patch points are easy to override and much less scary. Beyond that, MiniTest is also faster and has some neat benefits over test/unit (like benchmark assertions, etc). So, off we went.
8
8
 
9
9
  The goal is to be as configurable as possible with some nice defaults. My problem with most test enhancers is that they monkey patch blindly with very little openness and room for configuration. MiniTest::Display should allow for an infinite number (evenutally) of test display enhancements.
10
10
 
11
11
  Needless to say, it's a work in progress.
12
12
 
13
- == Requirements
13
+ ## Requirements
14
14
 
15
15
  Requires Ruby 1.9 and the gem version of minitest >= 2.0.2
16
16
 
17
- == Usage
17
+ ## Usage
18
18
 
19
19
  Install minitest and minitest display:
20
20
 
@@ -30,17 +30,20 @@ In your test suite/test_helper, require and configure mini test/display:
30
30
  color: true,
31
31
  print: {
32
32
  success: "OK\n",
33
- failure: "EPIC FAIL\n"
33
+ failure: "EPIC FAIL\n",
34
34
  error: "ERRRRRRR\n"
35
35
  }
36
36
  }
37
37
 
38
38
  That suite will look pretty funny.
39
39
 
40
- For all current available options see the code:
41
- https://github.com/quirkey/minitest-display/blob/master/lib/minitest/display.rb#L25
40
+ The default output looks something like:
42
41
 
43
- == Contributing to minitest-display
42
+ ![Term](http://www.quirkey.com/skitch/Terminal_%E2%80%94_bash_%E2%80%94_120%C3%9730-20110327-210856.jpg)
43
+
44
+ For all current available options [see the code](https://github.com/quirkey/minitest-display/blob/master/lib/minitest/display.rb#L25)
45
+
46
+ ## Contributing to minitest-display
44
47
 
45
48
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
46
49
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
@@ -50,7 +53,7 @@ https://github.com/quirkey/minitest-display/blob/master/lib/minitest/display.rb#
50
53
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
51
54
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
52
55
 
53
- == Copyright
56
+ ## Copyright
54
57
 
55
58
  Copyright (c) 2011 Aaron Quint. See LICENSE.txt for
56
59
  further details.
data/Rakefile CHANGED
@@ -23,7 +23,7 @@ Jeweler::Tasks.new do |gem|
23
23
  gem.authors = ["Aaron Quint"]
24
24
  # Include your dependencies below. Runtime dependencies are required when using your gem,
25
25
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
26
- gem.add_runtime_dependency 'minitest', '~> 2.0.2'
26
+ gem.add_runtime_dependency 'minitest', '~> 2.3'
27
27
  # gem.add_development_dependency 'rspec', '> 1.2.3'
28
28
  end
29
29
  Jeweler::RubygemsDotOrgTasks.new
@@ -18,15 +18,17 @@ end
18
18
 
19
19
  module MiniTest
20
20
  module Display
21
- VERSION = '0.0.2'
21
+ VERSION = '0.0.3'
22
22
 
23
23
  class << self
24
24
  def options
25
25
  @options ||= {
26
26
  suite_names: true,
27
27
  suite_divider: " | ",
28
+ suite_time: true,
28
29
  color: true,
29
30
  wrap_at: 80,
31
+ output_slow: 5,
30
32
  print: {
31
33
  success: '.',
32
34
  failure: 'F',
@@ -66,7 +68,7 @@ module MiniTest
66
68
  suite: :clear,
67
69
  success: :green,
68
70
  failure: :red,
69
- error: :red
71
+ error: :yellow
70
72
  }
71
73
  }
72
74
  end
@@ -164,6 +166,8 @@ class MiniTest::Unit
164
166
  wrap_at = display.options[:wrap_at] - suite_header.length
165
167
  wrap_count = wrap_at
166
168
 
169
+ full_start_time = Time.now
170
+ @test_times ||= []
167
171
  assertions = suite.send("#{type}_methods").grep(filter).map { |method|
168
172
  inst = suite.new method
169
173
  inst._assertions = 0
@@ -174,6 +178,8 @@ class MiniTest::Unit
174
178
  result = inst.run self
175
179
  time = Time.now - @start_time
176
180
 
181
+ @test_times << ["#{suite}##{method}", time]
182
+
177
183
  print "%.2f s = " % time if @verbose
178
184
  print case result
179
185
  when "."
@@ -196,6 +202,13 @@ class MiniTest::Unit
196
202
  inst._assertions
197
203
  }
198
204
 
205
+ total_time = Time.now - full_start_time
206
+
207
+ if assertions.length > 0 && display.options[:suite_time]
208
+ print "\n#{' ' * suite_header.length}#{display.options[:suite_divider]}"
209
+ print "%.2f s" % total_time
210
+ puts
211
+ end
199
212
  return assertions.size, assertions.inject(0) { |sum, n| sum + n }
200
213
  end
201
214
 
@@ -203,6 +216,14 @@ class MiniTest::Unit
203
216
  format = "%d tests, %d assertions, %d failures, %d errors, %d skips"
204
217
  final_status = failures + errors > 0 ? :failure : :success
205
218
  io.puts display.color(format % [test_count, assertion_count, failures, errors, skips], [:bold, final_status])
219
+
220
+ if display.options[:output_slow]
221
+ @test_times.sort! {|a, b| b[1] <=> a[1] }
222
+ puts "Slowest tests:"
223
+ @test_times[0..display.options[:output_slow].to_i].each do |test_name, time|
224
+ puts "%.2f s\t#{test_name}" % time
225
+ end
226
+ end
206
227
  end
207
228
 
208
229
  private
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{minitest-display}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Quint"]
12
- s.date = %q{2011-03-27}
12
+ s.date = %q{2011-08-02}
13
13
  s.description = %q{Patches MiniTest to allow for an easily configurable output. For Ruby 1.9 :Datches MiniTest to allow for an easily configurable output. For Ruby 1.9 :D. Inspired by leftright, redgreen and other test output gems, with an emphasis on configuration and style}
14
14
  s.email = %q{aaron@quirkey.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc",
17
+ "README.md",
18
18
  "TODO"
19
19
  ]
20
20
  s.files = [
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
24
  "LICENSE.txt",
25
- "README.rdoc",
25
+ "README.md",
26
26
  "Rakefile",
27
27
  "TODO",
28
28
  "lib/minitest/display.rb",
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.homepage = %q{http://github.com/quirkey/minitest-display}
34
34
  s.licenses = ["MIT"]
35
35
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.3.7}
36
+ s.rubygems_version = %q{1.6.2}
37
37
  s.summary = %q{Patches MiniTest to allow for an easily configurable output. For Ruby 1.9 :D}
38
38
  s.test_files = [
39
39
  "test/helper.rb",
@@ -41,25 +41,24 @@ Gem::Specification.new do |s|
41
41
  ]
42
42
 
43
43
  if s.respond_to? :specification_version then
44
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
44
  s.specification_version = 3
46
45
 
47
46
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
47
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
49
48
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
50
- s.add_development_dependency(%q<minitest>, ["= 2.0.2"])
51
- s.add_runtime_dependency(%q<minitest>, ["~> 2.0.2"])
49
+ s.add_development_dependency(%q<minitest>, [">= 0"])
50
+ s.add_runtime_dependency(%q<minitest>, ["~> 2.3"])
52
51
  else
53
52
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
53
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
55
- s.add_dependency(%q<minitest>, ["= 2.0.2"])
56
- s.add_dependency(%q<minitest>, ["~> 2.0.2"])
54
+ s.add_dependency(%q<minitest>, [">= 0"])
55
+ s.add_dependency(%q<minitest>, ["~> 2.3"])
57
56
  end
58
57
  else
59
58
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
59
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
61
- s.add_dependency(%q<minitest>, ["= 2.0.2"])
62
- s.add_dependency(%q<minitest>, ["~> 2.0.2"])
60
+ s.add_dependency(%q<minitest>, [">= 0"])
61
+ s.add_dependency(%q<minitest>, ["~> 2.3"])
63
62
  end
64
63
  end
65
64
 
metadata CHANGED
@@ -1,98 +1,78 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: minitest-display
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 2
9
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Aaron Quint
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-03-27 00:00:00 -07:00
12
+ date: 2011-08-02 00:00:00.000000000 -07:00
18
13
  default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
21
16
  name: bundler
22
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2164518120 !ruby/object:Gem::Requirement
23
18
  none: false
24
- requirements:
19
+ requirements:
25
20
  - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 0
30
- - 0
21
+ - !ruby/object:Gem::Version
31
22
  version: 1.0.0
32
23
  type: :development
33
24
  prerelease: false
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *2164518120
26
+ - !ruby/object:Gem::Dependency
36
27
  name: jeweler
37
- requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirement: &2164516960 !ruby/object:Gem::Requirement
38
29
  none: false
39
- requirements:
30
+ requirements:
40
31
  - - ~>
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 1
44
- - 5
45
- - 2
32
+ - !ruby/object:Gem::Version
46
33
  version: 1.5.2
47
34
  type: :development
48
35
  prerelease: false
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *2164516960
37
+ - !ruby/object:Gem::Dependency
51
38
  name: minitest
52
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ requirement: &2164515880 !ruby/object:Gem::Requirement
53
40
  none: false
54
- requirements:
55
- - - "="
56
- - !ruby/object:Gem::Version
57
- segments:
58
- - 2
59
- - 0
60
- - 2
61
- version: 2.0.2
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
62
45
  type: :development
63
46
  prerelease: false
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *2164515880
48
+ - !ruby/object:Gem::Dependency
66
49
  name: minitest
67
- requirement: &id004 !ruby/object:Gem::Requirement
50
+ requirement: &2164515180 !ruby/object:Gem::Requirement
68
51
  none: false
69
- requirements:
52
+ requirements:
70
53
  - - ~>
71
- - !ruby/object:Gem::Version
72
- segments:
73
- - 2
74
- - 0
75
- - 2
76
- version: 2.0.2
54
+ - !ruby/object:Gem::Version
55
+ version: '2.3'
77
56
  type: :runtime
78
57
  prerelease: false
79
- version_requirements: *id004
80
- description: Patches MiniTest to allow for an easily configurable output. For Ruby 1.9 :Datches MiniTest to allow for an easily configurable output. For Ruby 1.9 :D. Inspired by leftright, redgreen and other test output gems, with an emphasis on configuration and style
58
+ version_requirements: *2164515180
59
+ description: Patches MiniTest to allow for an easily configurable output. For Ruby
60
+ 1.9 :Datches MiniTest to allow for an easily configurable output. For Ruby 1.9 :D.
61
+ Inspired by leftright, redgreen and other test output gems, with an emphasis on
62
+ configuration and style
81
63
  email: aaron@quirkey.com
82
64
  executables: []
83
-
84
65
  extensions: []
85
-
86
- extra_rdoc_files:
66
+ extra_rdoc_files:
87
67
  - LICENSE.txt
88
- - README.rdoc
68
+ - README.md
89
69
  - TODO
90
- files:
70
+ files:
91
71
  - .document
92
72
  - Gemfile
93
73
  - Gemfile.lock
94
74
  - LICENSE.txt
95
- - README.rdoc
75
+ - README.md
96
76
  - Rakefile
97
77
  - TODO
98
78
  - lib/minitest/display.rb
@@ -101,37 +81,34 @@ files:
101
81
  - test/test_minitest-display.rb
102
82
  has_rdoc: true
103
83
  homepage: http://github.com/quirkey/minitest-display
104
- licenses:
84
+ licenses:
105
85
  - MIT
106
86
  post_install_message:
107
87
  rdoc_options: []
108
-
109
- require_paths:
88
+ require_paths:
110
89
  - lib
111
- required_ruby_version: !ruby/object:Gem::Requirement
90
+ required_ruby_version: !ruby/object:Gem::Requirement
112
91
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 2533676702413746939
117
- segments:
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ segments:
118
97
  - 0
119
- version: "0"
120
- required_rubygems_version: !ruby/object:Gem::Requirement
98
+ hash: 288969228019480240
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
100
  none: false
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- segments:
126
- - 0
127
- version: "0"
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
128
105
  requirements: []
129
-
130
106
  rubyforge_project:
131
- rubygems_version: 1.3.7
107
+ rubygems_version: 1.6.2
132
108
  signing_key:
133
109
  specification_version: 3
134
- summary: Patches MiniTest to allow for an easily configurable output. For Ruby 1.9 :D
135
- test_files:
110
+ summary: Patches MiniTest to allow for an easily configurable output. For Ruby 1.9
111
+ :D
112
+ test_files:
136
113
  - test/helper.rb
137
114
  - test/test_minitest-display.rb