minitest-reporters 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,12 +25,12 @@ Want to use multiple reporters?
25
25
 
26
26
  The following reporters are provided:
27
27
 
28
- MiniTest::Reporters::DefaultReporter # => Identical to the standard MiniTest reporter
29
- MiniTest::Reporters::SpecReporter # => Turn-like output that reads like a spec
28
+ MiniTest::Reporters::DefaultReporter # => Identical to the standard MiniTest reporter
29
+ MiniTest::Reporters::SpecReporter # => Turn-like output that reads like a spec
30
30
  MiniTest::Reporters::ProgressReporter # => Fuubar-like output with a progress bar
31
31
  MiniTest::Reporters::RubyMateReporter # => Simple reporter designed for RubyMate
32
32
  MiniTest::Reporters::RubyMineReporter # => Reporter designed for RubyMine IDE and TeamCity CI server; see below
33
- MiniTest::Reporters::GuardReporter # => Integrates with guard-minitest to provide on-screen notifications
33
+ MiniTest::Reporters::GuardReporter # => Integrates with guard-minitest to provide on-screen notifications
34
34
 
35
35
  ## TODO ##
36
36
 
@@ -1,5 +1,5 @@
1
1
  require 'ansi'
2
- require 'progressbar'
2
+ require 'powerbar'
3
3
 
4
4
  module MiniTest
5
5
  module Reporters
@@ -25,24 +25,29 @@ module MiniTest
25
25
  @backtrace_filter = options
26
26
  @detailed_skip = true
27
27
  end
28
+
29
+ @progress = PowerBar.new(:msg => "0/#{runner.test_count}")
30
+ @progress.settings.tty.finite.output = lambda { |s| print(s) }
31
+ @progress.settings.tty.finite.template.barchar = "="
32
+ @progress.settings.tty.finite.template.padchar = " "
33
+ @progress.settings.tty.finite.template.pre = "\e[1000D\e[?25l#{GREEN}"
34
+ @progress.settings.tty.finite.template.post = CLEAR
28
35
  end
29
36
 
30
37
  def before_suites(suites, type)
31
38
  puts 'Started'
32
39
  puts
33
40
 
34
- @color = GREEN
35
41
  @finished_count = 0
36
- @progress = ProgressBar.new("0/#{runner.test_count}", runner.test_count, runner.output)
37
- @progress.bar_mark = '='
38
42
  end
39
43
 
40
44
  def increment
41
- with_color do
42
- @finished_count += 1
43
- @progress.instance_variable_set('@title', "#{@finished_count}/#{runner.test_count}")
44
- @progress.inc
45
- end
45
+ @finished_count += 1
46
+ @progress.show({
47
+ :msg => "#{@finished_count}/#{runner.test_count}",
48
+ :done => @finished_count,
49
+ :total => runner.test_count
50
+ }, true)
46
51
  end
47
52
 
48
53
  def pass(suite, test, test_runner)
@@ -50,43 +55,48 @@ module MiniTest
50
55
  end
51
56
 
52
57
  def skip(suite, test, test_runner)
53
- @color = YELLOW unless @color == RED
54
-
55
58
  if @detailed_skip
59
+ wipe
56
60
  print(yellow { 'SKIP' })
57
61
  print_test_with_time(suite, test)
58
62
  puts
59
63
  puts
60
64
  end
61
65
 
66
+ self.color = YELLOW unless color == RED
62
67
  increment
63
68
  end
64
69
 
65
70
  def failure(suite, test, test_runner)
66
- @color = RED
71
+ wipe
67
72
  print(red { 'FAIL' })
68
73
  print_test_with_time(suite, test)
69
74
  puts
70
75
  print_info(test_runner.exception)
71
76
  puts
77
+
78
+ self.color = RED
72
79
  increment
73
80
  end
74
81
 
75
82
  def error(suite, test, test_runner)
76
- @color = RED
83
+ wipe
77
84
  print(red { 'ERROR' })
78
85
  print_test_with_time(suite, test)
79
86
  puts
80
87
  print_info(test_runner.exception)
81
88
  puts
89
+
90
+ self.color = RED
82
91
  increment
83
92
  end
84
93
 
85
94
  def after_suites(suites, type)
86
- with_color { @progress.finish }
95
+ @progress.close
87
96
 
88
97
  total_time = Time.now - runner.start_time
89
98
 
99
+ wipe
90
100
  puts
91
101
  puts('Finished in %.5fs' % total_time)
92
102
  print('%d tests, %d assertions, ' % [runner.test_count, runner.assertion_count])
@@ -97,6 +107,10 @@ module MiniTest
97
107
 
98
108
  private
99
109
 
110
+ def wipe
111
+ @progress.wipe
112
+ end
113
+
100
114
  def print_test_with_time(suite, test)
101
115
  total_time = Time.now - runner.test_start_time
102
116
  print(" #{suite}##{test} (%.2fs)#{clr}" % total_time)
@@ -113,10 +127,13 @@ module MiniTest
113
127
  ' ' * INFO_PADDING + str
114
128
  end
115
129
 
116
- def with_color
117
- print @color
118
- yield
119
- print CLEAR
130
+ def color
131
+ @color ||= GREEN
132
+ end
133
+
134
+ def color=(color)
135
+ @color = color
136
+ @progress.scope.template.pre = "\e[1000D\e[?25l#{@color}"
120
137
  end
121
138
  end
122
139
  end
@@ -1,5 +1,4 @@
1
1
  require 'ansi'
2
- require 'progressbar'
3
2
 
4
3
  module MiniTest
5
4
  module Reporters
@@ -1,5 +1,5 @@
1
1
  module MiniTest
2
2
  module Reporters
3
- VERSION = "0.8.0"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency 'minitest', '>= 2.0', '< 4.0'
18
18
  s.add_dependency 'ansi'
19
- s.add_dependency 'ruby-progressbar'
19
+ s.add_dependency 'powerbar'
20
20
  s.add_dependency 'builder'
21
21
 
22
22
  s.add_development_dependency 'mocha'
@@ -161,4 +161,4 @@ module MiniTestReportersTest
161
161
  MiniTest::Unit::TestCase.stubs(:test_suites).returns(suites)
162
162
  end
163
163
  end
164
- end
164
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-reporters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-30 00:00:00.000000000 Z
12
+ date: 2012-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -50,7 +50,7 @@ dependencies:
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  - !ruby/object:Gem::Dependency
53
- name: ruby-progressbar
53
+ name: powerbar
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements:
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  segments:
203
203
  - 0
204
- hash: -2178815342268569310
204
+ hash: -2934247906506335852
205
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  none: false
207
207
  requirements:
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  segments:
212
212
  - 0
213
- hash: -2178815342268569310
213
+ hash: -2934247906506335852
214
214
  requirements: []
215
215
  rubyforge_project: minitest-reporters
216
216
  rubygems_version: 1.8.24