| 1 |
require_relative "../../test_helper" |
| 2 |
|
| 3 |
module MinitestReportersTest |
| 4 |
class ProgressReporterTest < TestCase |
| 5 |
def test_all_failures_are_displayed |
| 6 |
fixtures_directory = File.expand_path('../../../fixtures', __FILE__) |
| 7 |
test_filename = File.join(fixtures_directory, 'progress_test.rb') |
| 8 |
output = `#{ruby_executable} #{test_filename} 2>&1` |
| 9 |
assert_match 'test_error', output, 'Errors should be displayed' |
| 10 |
assert_match 'test_failure', output, 'Failures should be displayed' |
| 11 |
assert_match 'test_skip', output, 'Skipped tests should be displayed' |
| 12 |
end |
| 13 |
def test_skipped_tests_are_not_displayed |
| 14 |
fixtures_directory = File.expand_path('../../../fixtures', __FILE__) |
| 15 |
test_filename = File.join(fixtures_directory, 'progress_detailed_skip_test.rb') |
| 16 |
output = `#{ruby_executable} #{test_filename} 2>&1` |
| 17 |
assert_match 'test_error', output, 'Errors should be displayed' |
| 18 |
assert_match 'test_failure', output, 'Failures should be displayed' |
| 19 |
refute_match 'test_skip', output, 'Skipped tests should not be displayed' |
| 20 |
end |
| 21 |
def test_progress_works_with_filter_and_specs |
| 22 |
fixtures_directory = File.expand_path('../../../fixtures', __FILE__) |
| 23 |
test_filename = File.join(fixtures_directory, 'spec_test.rb') |
| 24 |
output = `#{ruby_executable} #{test_filename} -n /length/ 2>&1` |
| 25 |
refute_match '0 out of 0', output, 'Progress should not puts a warning' |
| 26 |
end |
| 27 |
def test_progress_works_with_strict_filter |
| 28 |
fixtures_directory = File.expand_path('../../../fixtures', __FILE__) |
| 29 |
test_filename = File.join(fixtures_directory, 'spec_test.rb') |
| 30 |
output = `#{ruby_executable} #{test_filename} -n /^test_0001_works$/ 2>&1` |
| 31 |
refute_match '0 out of 0', output, 'Progress should not puts a warning' |
| 32 |
end |
| 33 |
|
| 34 |
private |
| 35 |
|
| 36 |
def ruby_executable |
| 37 |
defined?(JRUBY_VERSION) ? 'jruby' : 'ruby' |
| 38 |
end |
| 39 |
end |
| 40 |
end |