minitest-reporters 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +28 -27
- data/.rubocop.yml +77 -77
- data/.ruby-gemset +1 -1
- data/.travis.yml +14 -14
- data/.yardopts +5 -5
- data/CHANGELOG.md +98 -93
- data/Gemfile +2 -2
- data/LICENSE +20 -20
- data/README.md +135 -135
- data/Rakefile +70 -70
- data/appveyor.yml +22 -22
- data/lib/minitest/extensible_backtrace_filter.rb +67 -67
- data/lib/minitest/minitest_reporter_plugin.rb +76 -76
- data/lib/minitest/old_activesupport_fix.rb +24 -24
- data/lib/minitest/relative_position.rb +26 -26
- data/lib/minitest/reporters.rb +91 -91
- data/lib/minitest/reporters/ansi.rb +30 -30
- data/lib/minitest/reporters/base_reporter.rb +136 -136
- data/lib/minitest/reporters/default_reporter.rb +228 -228
- data/lib/minitest/reporters/html_reporter.rb +224 -224
- data/lib/minitest/reporters/junit_reporter.rb +168 -164
- data/lib/minitest/reporters/mean_time_reporter.rb +388 -388
- data/lib/minitest/reporters/progress_reporter.rb +102 -96
- data/lib/minitest/reporters/ruby_mate_reporter.rb +54 -54
- data/lib/minitest/reporters/rubymine_reporter.rb +116 -116
- data/lib/minitest/reporters/spec_reporter.rb +61 -61
- data/lib/minitest/reporters/version.rb +5 -5
- data/lib/minitest/templates/index.html.erb +82 -82
- data/minitest-reporters.gemspec +31 -32
- data/test/fixtures/junit_filename_bug_example_test.rb +41 -41
- data/test/fixtures/mean_time_test.rb +36 -36
- data/test/fixtures/progress_detailed_skip_test.rb +8 -8
- data/test/fixtures/progress_test.rb +8 -8
- data/test/fixtures/sample_test.rb +15 -15
- data/test/fixtures/spec_test.rb +18 -18
- data/test/gallery/bad_test.rb +25 -25
- data/test/gallery/good_test.rb +14 -14
- data/test/integration/reporters/junit_reporter_test.rb +12 -12
- data/test/integration/reporters/mean_time_reporter_test.rb +7 -7
- data/test/integration/reporters/progress_reporter_test.rb +40 -40
- data/test/test_helper.rb +22 -22
- data/test/unit/minitest/extensible_backtrace_filter_test.rb +42 -42
- data/test/unit/minitest/junit_reporter_test.rb +46 -23
- data/test/unit/minitest/mean_time_reporter_unit_test.rb +149 -149
- data/test/unit/minitest/minitest_reporter_plugin_test.rb +14 -14
- data/test/unit/minitest/reporters_test.rb +65 -65
- data/test/unit/minitest/spec_reporter_test.rb +62 -62
- metadata +22 -5
@@ -1,149 +1,149 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
|
3
|
-
module MinitestReportersTest
|
4
|
-
class MeanTimeReporterUnitTest < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@test_data = []
|
7
|
-
@test_data << { name: 'MIDDLE', prev_time: 5.0, cur_time: 5.0 }
|
8
|
-
@test_data << { name: 'MIN_FAST', prev_time: 0.5, cur_time: 3.5 }
|
9
|
-
@test_data << { name: 'MIN_SLOW', prev_time: 10.5, cur_time: 10.5 }
|
10
|
-
@test_data << { name: 'MAX_FAST', prev_time: 1.2, cur_time: 0.9 }
|
11
|
-
@test_data << { name: 'MAX_SLOW', prev_time: 16.3, cur_time: 6.3 }
|
12
|
-
@test_data << { name: 'AVG_FAST', prev_time: 1.3, cur_time: 0.65 }
|
13
|
-
@test_data << { name: 'AVG_SLOW', prev_time: 10.2, cur_time: 14.2 }
|
14
|
-
configure_report_paths
|
15
|
-
end
|
16
|
-
|
17
|
-
def teardown
|
18
|
-
File.delete(@previous_run_path) if File.exist?(@previous_run_path)
|
19
|
-
File.delete(@report_file_path) if File.exist?(@report_file_path)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_defaults
|
23
|
-
subject = Minitest::Reporters::MeanTimeReporter.new.send(:defaults)
|
24
|
-
|
25
|
-
expected_prefix = "#{Dir.tmpdir}#{File::Separator}"
|
26
|
-
assert_match expected_prefix, subject[:previous_runs_filename]
|
27
|
-
assert_match expected_prefix, subject[:report_filename]
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_sorts_avg_numerically
|
31
|
-
prev_output = generate_report(:avg, :prev_time)
|
32
|
-
report_output = generate_report(:avg, :cur_time)
|
33
|
-
|
34
|
-
expected_order = [
|
35
|
-
'AVG_SLOW',
|
36
|
-
'MAX_SLOW',
|
37
|
-
'MIN_SLOW',
|
38
|
-
'MIDDLE',
|
39
|
-
'MIN_FAST',
|
40
|
-
'MAX_FAST',
|
41
|
-
'AVG_FAST'
|
42
|
-
]
|
43
|
-
verify_result_order(report_output, expected_order, prev_output)
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_sorts_min_numerically
|
47
|
-
prev_output = generate_report(:min, :prev_time)
|
48
|
-
report_output = generate_report(:min, :cur_time)
|
49
|
-
|
50
|
-
expected_order = [
|
51
|
-
'MIN_SLOW',
|
52
|
-
'AVG_SLOW',
|
53
|
-
'MAX_SLOW',
|
54
|
-
'MIDDLE',
|
55
|
-
'MAX_FAST',
|
56
|
-
'AVG_FAST',
|
57
|
-
'MIN_FAST'
|
58
|
-
]
|
59
|
-
verify_result_order(report_output, expected_order, prev_output)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_sorts_max_numerically
|
63
|
-
prev_output = generate_report(:max, :prev_time)
|
64
|
-
report_output = generate_report(:max, :cur_time)
|
65
|
-
|
66
|
-
expected_order = [
|
67
|
-
'MAX_SLOW',
|
68
|
-
'AVG_SLOW',
|
69
|
-
'MIN_SLOW',
|
70
|
-
'MIDDLE',
|
71
|
-
'MIN_FAST',
|
72
|
-
'AVG_FAST',
|
73
|
-
'MAX_FAST'
|
74
|
-
]
|
75
|
-
verify_result_order(report_output, expected_order, prev_output)
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_sorts_last_numerically
|
79
|
-
prev_output = generate_report(:last, :prev_time)
|
80
|
-
report_output = generate_report(:last, :cur_time)
|
81
|
-
|
82
|
-
expected_order = [
|
83
|
-
'AVG_SLOW',
|
84
|
-
'MIN_SLOW',
|
85
|
-
'MAX_SLOW',
|
86
|
-
'MIDDLE',
|
87
|
-
'MIN_FAST',
|
88
|
-
'MAX_FAST',
|
89
|
-
'AVG_FAST'
|
90
|
-
]
|
91
|
-
verify_result_order(report_output, expected_order, prev_output)
|
92
|
-
end
|
93
|
-
|
94
|
-
private
|
95
|
-
|
96
|
-
def simulate_suite_runtime(suite_name, run_time)
|
97
|
-
test_suite = Minitest::Test.new(suite_name)
|
98
|
-
base_clock_time = Minitest::Reporters.clock_time
|
99
|
-
Minitest::Reporters.stub(:clock_time, base_clock_time - run_time) do
|
100
|
-
@reporter.before_suite(test_suite)
|
101
|
-
end
|
102
|
-
Minitest::Reporters.stub(:clock_time, base_clock_time) do
|
103
|
-
@reporter.after_suite(test_suite)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def configure_report_paths
|
108
|
-
@previous_run_path = File.expand_path("../minitest-mean-time-previous-runs", File.realpath(__FILE__))
|
109
|
-
File.delete(@previous_run_path) if File.exist?(@previous_run_path)
|
110
|
-
@report_file_path = File.expand_path("../minitest-mean-time-report", File.realpath(__FILE__))
|
111
|
-
File.delete(@report_file_path) if File.exist?(@report_file_path)
|
112
|
-
end
|
113
|
-
|
114
|
-
def generate_report(sort_column, time_name)
|
115
|
-
# Reset the reporter for the test run
|
116
|
-
@reporter = Minitest::Reporters::MeanTimeReporter.new(
|
117
|
-
previous_runs_filename: @previous_run_path,
|
118
|
-
report_filename: @report_file_path,
|
119
|
-
sort_column: sort_column
|
120
|
-
)
|
121
|
-
@test_data.each { |hash| simulate_suite_runtime(hash[:name], hash[time_name])}
|
122
|
-
@reporter.tests << Minitest::Test.new('Final')
|
123
|
-
|
124
|
-
report_output = StringIO.new
|
125
|
-
@reporter.io = report_output
|
126
|
-
@reporter.start
|
127
|
-
@reporter.report
|
128
|
-
report_output
|
129
|
-
end
|
130
|
-
|
131
|
-
def verify_result_order(report_output, expected_order, prev_output)
|
132
|
-
prev_lines = extract_test_lines(prev_output)
|
133
|
-
test_lines = extract_test_lines(report_output)
|
134
|
-
|
135
|
-
actual_order = test_lines.map { |line| line.gsub(/.*Description: /, '') }
|
136
|
-
|
137
|
-
assert_equal(expected_order, actual_order, "\nCurrent report:\n#{test_lines.join("\n")}\n\nPrevious report:\n#{prev_lines.join("\n")}")
|
138
|
-
end
|
139
|
-
|
140
|
-
def extract_test_lines(report_output)
|
141
|
-
report_output.rewind
|
142
|
-
test_lines = report_output.read.split("\n")
|
143
|
-
test_lines.select! {|line| line.start_with?('Avg:')}
|
144
|
-
# Exclude the final placeholder 0 second test from assertions
|
145
|
-
test_lines.reject! {|line| line.end_with?('Minitest::Test')}
|
146
|
-
test_lines
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
module MinitestReportersTest
|
4
|
+
class MeanTimeReporterUnitTest < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@test_data = []
|
7
|
+
@test_data << { name: 'MIDDLE', prev_time: 5.0, cur_time: 5.0 }
|
8
|
+
@test_data << { name: 'MIN_FAST', prev_time: 0.5, cur_time: 3.5 }
|
9
|
+
@test_data << { name: 'MIN_SLOW', prev_time: 10.5, cur_time: 10.5 }
|
10
|
+
@test_data << { name: 'MAX_FAST', prev_time: 1.2, cur_time: 0.9 }
|
11
|
+
@test_data << { name: 'MAX_SLOW', prev_time: 16.3, cur_time: 6.3 }
|
12
|
+
@test_data << { name: 'AVG_FAST', prev_time: 1.3, cur_time: 0.65 }
|
13
|
+
@test_data << { name: 'AVG_SLOW', prev_time: 10.2, cur_time: 14.2 }
|
14
|
+
configure_report_paths
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
File.delete(@previous_run_path) if File.exist?(@previous_run_path)
|
19
|
+
File.delete(@report_file_path) if File.exist?(@report_file_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_defaults
|
23
|
+
subject = Minitest::Reporters::MeanTimeReporter.new.send(:defaults)
|
24
|
+
|
25
|
+
expected_prefix = "#{Dir.tmpdir}#{File::Separator}"
|
26
|
+
assert_match expected_prefix, subject[:previous_runs_filename]
|
27
|
+
assert_match expected_prefix, subject[:report_filename]
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_sorts_avg_numerically
|
31
|
+
prev_output = generate_report(:avg, :prev_time)
|
32
|
+
report_output = generate_report(:avg, :cur_time)
|
33
|
+
|
34
|
+
expected_order = [
|
35
|
+
'AVG_SLOW',
|
36
|
+
'MAX_SLOW',
|
37
|
+
'MIN_SLOW',
|
38
|
+
'MIDDLE',
|
39
|
+
'MIN_FAST',
|
40
|
+
'MAX_FAST',
|
41
|
+
'AVG_FAST'
|
42
|
+
]
|
43
|
+
verify_result_order(report_output, expected_order, prev_output)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_sorts_min_numerically
|
47
|
+
prev_output = generate_report(:min, :prev_time)
|
48
|
+
report_output = generate_report(:min, :cur_time)
|
49
|
+
|
50
|
+
expected_order = [
|
51
|
+
'MIN_SLOW',
|
52
|
+
'AVG_SLOW',
|
53
|
+
'MAX_SLOW',
|
54
|
+
'MIDDLE',
|
55
|
+
'MAX_FAST',
|
56
|
+
'AVG_FAST',
|
57
|
+
'MIN_FAST'
|
58
|
+
]
|
59
|
+
verify_result_order(report_output, expected_order, prev_output)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_sorts_max_numerically
|
63
|
+
prev_output = generate_report(:max, :prev_time)
|
64
|
+
report_output = generate_report(:max, :cur_time)
|
65
|
+
|
66
|
+
expected_order = [
|
67
|
+
'MAX_SLOW',
|
68
|
+
'AVG_SLOW',
|
69
|
+
'MIN_SLOW',
|
70
|
+
'MIDDLE',
|
71
|
+
'MIN_FAST',
|
72
|
+
'AVG_FAST',
|
73
|
+
'MAX_FAST'
|
74
|
+
]
|
75
|
+
verify_result_order(report_output, expected_order, prev_output)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_sorts_last_numerically
|
79
|
+
prev_output = generate_report(:last, :prev_time)
|
80
|
+
report_output = generate_report(:last, :cur_time)
|
81
|
+
|
82
|
+
expected_order = [
|
83
|
+
'AVG_SLOW',
|
84
|
+
'MIN_SLOW',
|
85
|
+
'MAX_SLOW',
|
86
|
+
'MIDDLE',
|
87
|
+
'MIN_FAST',
|
88
|
+
'MAX_FAST',
|
89
|
+
'AVG_FAST'
|
90
|
+
]
|
91
|
+
verify_result_order(report_output, expected_order, prev_output)
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def simulate_suite_runtime(suite_name, run_time)
|
97
|
+
test_suite = Minitest::Test.new(suite_name)
|
98
|
+
base_clock_time = Minitest::Reporters.clock_time
|
99
|
+
Minitest::Reporters.stub(:clock_time, base_clock_time - run_time) do
|
100
|
+
@reporter.before_suite(test_suite)
|
101
|
+
end
|
102
|
+
Minitest::Reporters.stub(:clock_time, base_clock_time) do
|
103
|
+
@reporter.after_suite(test_suite)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def configure_report_paths
|
108
|
+
@previous_run_path = File.expand_path("../minitest-mean-time-previous-runs", File.realpath(__FILE__))
|
109
|
+
File.delete(@previous_run_path) if File.exist?(@previous_run_path)
|
110
|
+
@report_file_path = File.expand_path("../minitest-mean-time-report", File.realpath(__FILE__))
|
111
|
+
File.delete(@report_file_path) if File.exist?(@report_file_path)
|
112
|
+
end
|
113
|
+
|
114
|
+
def generate_report(sort_column, time_name)
|
115
|
+
# Reset the reporter for the test run
|
116
|
+
@reporter = Minitest::Reporters::MeanTimeReporter.new(
|
117
|
+
previous_runs_filename: @previous_run_path,
|
118
|
+
report_filename: @report_file_path,
|
119
|
+
sort_column: sort_column
|
120
|
+
)
|
121
|
+
@test_data.each { |hash| simulate_suite_runtime(hash[:name], hash[time_name])}
|
122
|
+
@reporter.tests << Minitest::Test.new('Final')
|
123
|
+
|
124
|
+
report_output = StringIO.new
|
125
|
+
@reporter.io = report_output
|
126
|
+
@reporter.start
|
127
|
+
@reporter.report
|
128
|
+
report_output
|
129
|
+
end
|
130
|
+
|
131
|
+
def verify_result_order(report_output, expected_order, prev_output)
|
132
|
+
prev_lines = extract_test_lines(prev_output)
|
133
|
+
test_lines = extract_test_lines(report_output)
|
134
|
+
|
135
|
+
actual_order = test_lines.map { |line| line.gsub(/.*Description: /, '') }
|
136
|
+
|
137
|
+
assert_equal(expected_order, actual_order, "\nCurrent report:\n#{test_lines.join("\n")}\n\nPrevious report:\n#{prev_lines.join("\n")}")
|
138
|
+
end
|
139
|
+
|
140
|
+
def extract_test_lines(report_output)
|
141
|
+
report_output.rewind
|
142
|
+
test_lines = report_output.read.split("\n")
|
143
|
+
test_lines.select! {|line| line.start_with?('Avg:')}
|
144
|
+
# Exclude the final placeholder 0 second test from assertions
|
145
|
+
test_lines.reject! {|line| line.end_with?('Minitest::Test')}
|
146
|
+
test_lines
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require_relative "../../test_helper"
|
2
|
-
|
3
|
-
module MinitestReportersTest
|
4
|
-
class MinitestReporterPluginTest < Minitest::Test
|
5
|
-
def test_delegates_io
|
6
|
-
reporter = Minitest::Reporters::DefaultReporter.new
|
7
|
-
io_handle = STDOUT
|
8
|
-
dr = Minitest::Reporters::DelegateReporter.new([ reporter ], :io => io_handle)
|
9
|
-
assert_equal io_handle, dr.io
|
10
|
-
dr.send :all_reporters
|
11
|
-
assert_equal io_handle, reporter.io
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require_relative "../../test_helper"
|
2
|
+
|
3
|
+
module MinitestReportersTest
|
4
|
+
class MinitestReporterPluginTest < Minitest::Test
|
5
|
+
def test_delegates_io
|
6
|
+
reporter = Minitest::Reporters::DefaultReporter.new
|
7
|
+
io_handle = STDOUT
|
8
|
+
dr = Minitest::Reporters::DelegateReporter.new([ reporter ], :io => io_handle)
|
9
|
+
assert_equal io_handle, dr.io
|
10
|
+
dr.send :all_reporters
|
11
|
+
assert_equal io_handle, reporter.io
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,65 +1,65 @@
|
|
1
|
-
require_relative "../../test_helper"
|
2
|
-
require "minitest/mock"
|
3
|
-
|
4
|
-
module MinitestReportersTest
|
5
|
-
class ReportersTest < Minitest::Test
|
6
|
-
def test_chooses_the_rubymine_reporter_when_necessary
|
7
|
-
# Rubymine reporter complains when RubyMine libs are not available, so
|
8
|
-
# stub its #puts method out.
|
9
|
-
$stdout.stub :puts, nil do
|
10
|
-
reporters = Minitest::Reporters.choose_reporters [], { "RM_INFO" => "x" }
|
11
|
-
assert_instance_of Minitest::Reporters::RubyMineReporter, reporters[0]
|
12
|
-
|
13
|
-
reporters = Minitest::Reporters.choose_reporters [], { "TEAMCITY_VERSION" => "x" }
|
14
|
-
assert_instance_of Minitest::Reporters::RubyMineReporter, reporters[0]
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_chooses_the_textmate_reporter_when_necessary
|
19
|
-
reporters = Minitest::Reporters.choose_reporters [], {"TM_PID" => "x"}
|
20
|
-
assert_instance_of Minitest::Reporters::RubyMateReporter, reporters[0]
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_chooses_the_console_reporters_when_necessary
|
24
|
-
reporters = Minitest::Reporters.choose_reporters [Minitest::Reporters::SpecReporter.new], {}
|
25
|
-
assert_instance_of Minitest::Reporters::SpecReporter, reporters[0]
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_chooses_no_reporters_when_running_under_vim
|
29
|
-
reporters = Minitest::Reporters.choose_reporters(
|
30
|
-
[Minitest::Reporters::DefaultReporter.new], { "VIM" => "/usr/share/vim" })
|
31
|
-
assert_nil reporters
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_chooses_given_reporter_when_MINITEST_REPORTERS_env_set
|
35
|
-
env = {
|
36
|
-
"MINITEST_REPORTER" => "JUnitReporter",
|
37
|
-
"RM_INFO" => "x",
|
38
|
-
"TEAMCITY_VERSION" => "x",
|
39
|
-
"TM_PID" => "x" }
|
40
|
-
# JUnit reporter init has stdout messages... capture them to keep test output clean
|
41
|
-
$stdout.stub :puts, nil do
|
42
|
-
reporters = Minitest::Reporters.choose_reporters [], env
|
43
|
-
assert_instance_of Minitest::Reporters::JUnitReporter, reporters[0]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_uses_minitest_clock_time_when_minitest_version_greater_than_561
|
48
|
-
Minitest::Reporters.stub :minitest_version, 583 do
|
49
|
-
Minitest.stub :clock_time, 6765.378751009 do
|
50
|
-
clock_time = Minitest::Reporters.clock_time
|
51
|
-
assert_equal 6765.378751009, clock_time
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_uses_minitest_clock_time_when_minitest_version_less_than_561
|
57
|
-
Minitest::Reporters.stub :minitest_version, 431 do
|
58
|
-
Time.stub :now, Time.new(2015, 11, 20, 17, 35) do
|
59
|
-
clock_time = Minitest::Reporters.clock_time
|
60
|
-
assert_equal Time.new(2015, 11, 20, 17, 35), clock_time
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
1
|
+
require_relative "../../test_helper"
|
2
|
+
require "minitest/mock"
|
3
|
+
|
4
|
+
module MinitestReportersTest
|
5
|
+
class ReportersTest < Minitest::Test
|
6
|
+
def test_chooses_the_rubymine_reporter_when_necessary
|
7
|
+
# Rubymine reporter complains when RubyMine libs are not available, so
|
8
|
+
# stub its #puts method out.
|
9
|
+
$stdout.stub :puts, nil do
|
10
|
+
reporters = Minitest::Reporters.choose_reporters [], { "RM_INFO" => "x" }
|
11
|
+
assert_instance_of Minitest::Reporters::RubyMineReporter, reporters[0]
|
12
|
+
|
13
|
+
reporters = Minitest::Reporters.choose_reporters [], { "TEAMCITY_VERSION" => "x" }
|
14
|
+
assert_instance_of Minitest::Reporters::RubyMineReporter, reporters[0]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_chooses_the_textmate_reporter_when_necessary
|
19
|
+
reporters = Minitest::Reporters.choose_reporters [], {"TM_PID" => "x"}
|
20
|
+
assert_instance_of Minitest::Reporters::RubyMateReporter, reporters[0]
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_chooses_the_console_reporters_when_necessary
|
24
|
+
reporters = Minitest::Reporters.choose_reporters [Minitest::Reporters::SpecReporter.new], {}
|
25
|
+
assert_instance_of Minitest::Reporters::SpecReporter, reporters[0]
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_chooses_no_reporters_when_running_under_vim
|
29
|
+
reporters = Minitest::Reporters.choose_reporters(
|
30
|
+
[Minitest::Reporters::DefaultReporter.new], { "VIM" => "/usr/share/vim" })
|
31
|
+
assert_nil reporters
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_chooses_given_reporter_when_MINITEST_REPORTERS_env_set
|
35
|
+
env = {
|
36
|
+
"MINITEST_REPORTER" => "JUnitReporter",
|
37
|
+
"RM_INFO" => "x",
|
38
|
+
"TEAMCITY_VERSION" => "x",
|
39
|
+
"TM_PID" => "x" }
|
40
|
+
# JUnit reporter init has stdout messages... capture them to keep test output clean
|
41
|
+
$stdout.stub :puts, nil do
|
42
|
+
reporters = Minitest::Reporters.choose_reporters [], env
|
43
|
+
assert_instance_of Minitest::Reporters::JUnitReporter, reporters[0]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_uses_minitest_clock_time_when_minitest_version_greater_than_561
|
48
|
+
Minitest::Reporters.stub :minitest_version, 583 do
|
49
|
+
Minitest.stub :clock_time, 6765.378751009 do
|
50
|
+
clock_time = Minitest::Reporters.clock_time
|
51
|
+
assert_equal 6765.378751009, clock_time
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_uses_minitest_clock_time_when_minitest_version_less_than_561
|
57
|
+
Minitest::Reporters.stub :minitest_version, 431 do
|
58
|
+
Time.stub :now, Time.new(2015, 11, 20, 17, 35) do
|
59
|
+
clock_time = Minitest::Reporters.clock_time
|
60
|
+
assert_equal Time.new(2015, 11, 20, 17, 35), clock_time
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|