Skip to content

Commit

Permalink
- Added a hack/kludge to deal with missing #prerecord on reporters th…
Browse files Browse the repository at this point in the history
…at aren't properly subclassing AbstractReporter (I'm looking at you minitest-reporters)

[git-p4: depot-paths = "//src/minitest/dev/": change = 11140]
  • Loading branch information
zenspider committed Dec 2, 2016
1 parent b48a4df commit cc4fb3b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/minitest.rb
Expand Up @@ -664,7 +664,8 @@ def start # :nodoc:

def prerecord klass, name # :nodoc:
self.reporters.each do |reporter|
reporter.prerecord klass, name
# TODO: remove conditional for minitest 6
reporter.prerecord klass, name if reporter.respond_to? :prerecord
end
end

Expand Down
24 changes: 24 additions & 0 deletions test/minitest/test_minitest_test.rb
Expand Up @@ -1948,6 +1948,30 @@ def assert_run_record *expected, &block
assert_equal expected, recorded
end

def test_run_with_bogus_reporter
# https://github.com/seattlerb/minitest/issues/659
# TODO: remove test for minitest 6
@tu = Class.new FakeNamedTest do
def test_method
assert true
end
end

self.reporter = Minitest::CompositeReporter.new
reporter << Class.new do
def start; end
# def prerecord klass, name; end
def record result; end
def report; end
def passed?; end
def results; end
end.new

Minitest::Runnable.runnables.delete @tu

@tu.run reporter, {}
end

def test_record_passing
assert_run_record do
def test_method
Expand Down

0 comments on commit cc4fb3b

Please sign in to comment.