minitest-reporters 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +17 -1
- data/lib/minitest/reporters/ruby_mate_reporter.rb +70 -0
- data/lib/minitest/reporters/version.rb +1 -1
- data/lib/minitest/reporters.rb +1 -0
- data/test/test_helper.rb +7 -4
- metadata +15 -14
data/README.md
CHANGED
@@ -24,8 +24,24 @@ The following reporters are provided:
|
|
24
24
|
MiniTest::Reporters::DefaultReporter # => Identical to the standard MiniTest reporter
|
25
25
|
MiniTest::Reporters::SpecReporter # => Turn-like output that reads like a spec
|
26
26
|
MiniTest::Reporters::ProgressReporter # => Fuubar-like output with a progress bar
|
27
|
+
MiniTest::Reporters::RubyMateReporter # => Simple reporter designed for RubyMate; see below
|
27
28
|
|
28
|
-
I really like `ProgressReporter
|
29
|
+
I really like `ProgressReporter` for my everyday terminal usage, but I like
|
30
|
+
using `RubyMateReporter` when I'm executing test suites from TextMate. My usual
|
31
|
+
set up looks like this:
|
32
|
+
|
33
|
+
require 'minitest/reporters'
|
34
|
+
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
|
35
|
+
if ENV['TM_PID']
|
36
|
+
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMateReporter.new
|
37
|
+
else
|
38
|
+
MiniTest::Unit.runner.reporters << MiniTest::Reporters::ProgressReporter.new
|
39
|
+
end
|
40
|
+
|
41
|
+
## TODO ##
|
42
|
+
|
43
|
+
* Make the boilerplate code look prettier. Something like a one-line require for the general use-case would be nice.
|
44
|
+
* Add some example images of the reporters.
|
29
45
|
|
30
46
|
## Note on Patches/Pull Requests ##
|
31
47
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'ansi'
|
2
|
+
require 'progressbar'
|
3
|
+
|
4
|
+
module MiniTest
|
5
|
+
module Reporters
|
6
|
+
# Simple reporter designed for RubyMate.
|
7
|
+
class RubyMateReporter
|
8
|
+
include MiniTest::Reporter
|
9
|
+
|
10
|
+
INFO_PADDING = 2
|
11
|
+
|
12
|
+
def before_suites(suites, type)
|
13
|
+
puts 'Started'
|
14
|
+
puts
|
15
|
+
end
|
16
|
+
|
17
|
+
def skip(suite, test, test_runner)
|
18
|
+
print 'SKIP'
|
19
|
+
print_test_with_time(suite, test)
|
20
|
+
puts
|
21
|
+
puts
|
22
|
+
end
|
23
|
+
|
24
|
+
def failure(suite, test, test_runner)
|
25
|
+
print 'FAIL'
|
26
|
+
print_test_with_time(suite, test)
|
27
|
+
puts
|
28
|
+
print_info(test_runner.exception)
|
29
|
+
puts
|
30
|
+
end
|
31
|
+
|
32
|
+
def error(suite, test, test_runner)
|
33
|
+
print 'ERROR'
|
34
|
+
print_test_with_time(suite, test)
|
35
|
+
puts
|
36
|
+
print_info(test_runner.exception)
|
37
|
+
puts
|
38
|
+
end
|
39
|
+
|
40
|
+
def after_suites(suites, type)
|
41
|
+
total_time = Time.now - runner.start_time
|
42
|
+
|
43
|
+
puts
|
44
|
+
puts('Finished in %.5fs' % total_time)
|
45
|
+
print('%d tests, %d assertions, ' % [runner.test_count, runner.assertion_count])
|
46
|
+
print('%d failures, %d errors, ' % [runner.failures, runner.errors])
|
47
|
+
print('%d skips' % runner.skips)
|
48
|
+
puts
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def print_test_with_time(suite, test)
|
54
|
+
total_time = Time.now - runner.test_start_time
|
55
|
+
print(" #{suite}##{test} (%.2fs)" % total_time)
|
56
|
+
end
|
57
|
+
|
58
|
+
def print_info(e)
|
59
|
+
e.message.each_line { |line| puts pad(line) }
|
60
|
+
|
61
|
+
trace = MiniTest.filter_backtrace(e.backtrace)
|
62
|
+
trace.each { |line| puts pad(line) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def pad(str)
|
66
|
+
' ' * INFO_PADDING + str
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/minitest/reporters.rb
CHANGED
@@ -11,5 +11,6 @@ module MiniTest
|
|
11
11
|
autoload :DefaultReporter, 'minitest/reporters/default_reporter'
|
12
12
|
autoload :SpecReporter, 'minitest/reporters/spec_reporter'
|
13
13
|
autoload :ProgressReporter, 'minitest/reporters/progress_reporter'
|
14
|
+
autoload :RubyMateReporter, 'minitest/reporters/ruby_mate_reporter'
|
14
15
|
end
|
15
16
|
end
|
data/test/test_helper.rb
CHANGED
@@ -27,7 +27,10 @@ MiniTest::Unit.runner = MiniTest::SuiteRunner.new
|
|
27
27
|
#
|
28
28
|
# Personally, I like the progress reporter. Make sure you don't change that line
|
29
29
|
# when you commit.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
MiniTest::Unit.runner.reporters << MiniTest::Reporters::
|
30
|
+
if ENV['TM_PID']
|
31
|
+
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMateReporter.new
|
32
|
+
else
|
33
|
+
# MiniTest::Unit.runner.reporters << MiniTest::Reporters::DefaultReporter.new
|
34
|
+
# MiniTest::Unit.runner.reporters << MiniTest::Reporters::SpecReporter.new
|
35
|
+
MiniTest::Unit.runner.reporters << MiniTest::Reporters::ProgressReporter.new
|
36
|
+
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.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
16
|
-
requirement: &
|
16
|
+
requirement: &2164351020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2164351020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ansi
|
27
|
-
requirement: &
|
27
|
+
requirement: &2164350600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2164350600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ruby-progressbar
|
38
|
-
requirement: &
|
38
|
+
requirement: &2164350140 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2164350140
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mocha
|
49
|
-
requirement: &
|
49
|
+
requirement: &2164349720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2164349720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: maruku
|
60
|
-
requirement: &
|
60
|
+
requirement: &2164349300 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2164349300
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: test_declarative
|
71
|
-
requirement: &
|
71
|
+
requirement: &2164348880 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2164348880
|
80
80
|
description: Death to haphazard monkey-patching! Extend MiniTest through simple hooks.
|
81
81
|
email:
|
82
82
|
- alex@kernul.com
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/minitest/reporters.rb
|
96
96
|
- lib/minitest/reporters/default_reporter.rb
|
97
97
|
- lib/minitest/reporters/progress_reporter.rb
|
98
|
+
- lib/minitest/reporters/ruby_mate_reporter.rb
|
98
99
|
- lib/minitest/reporters/spec_reporter.rb
|
99
100
|
- lib/minitest/reporters/version.rb
|
100
101
|
- lib/minitest/suite_runner.rb
|