aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2018-01-10 15:46:29 -0800
committerGitHub <noreply@github.com>2018-01-10 15:46:29 -0800
commit013a8abd48a020954ff60524943fec82064147dc (patch)
tree773afb061e61abf38a14e744ca57e70c532518c5 /railties
parentae48c65e411e01c1045056562319666384bb1b63 (diff)
parent76b75ac09406304e4d03f2d643b2ebd7bdaa6224 (diff)
downloadrails-013a8abd48a020954ff60524943fec82064147dc.tar.gz
rails-013a8abd48a020954ff60524943fec82064147dc.tar.bz2
rails-013a8abd48a020954ff60524943fec82064147dc.zip
Merge pull request #31624 from y-yagi/fix_minitest_511
Add support for Minitest 5.11
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/test_unit/reporter.rb10
-rw-r--r--railties/test/test_unit/reporter_test.rb8
2 files changed, 12 insertions, 6 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb
index 7d3164f1eb..28b93cee5a 100644
--- a/railties/lib/rails/test_unit/reporter.rb
+++ b/railties/lib/rails/test_unit/reporter.rb
@@ -64,11 +64,17 @@ module Rails
end
def format_line(result)
- "%s#%s = %.2f s = %s" % [result.class, result.name, result.time, result.result_code]
+ klass = result.respond_to?(:klass) ? result.klass : result.class
+ "%s#%s = %.2f s = %s" % [klass, result.name, result.time, result.result_code]
end
def format_rerun_snippet(result)
- location, line = result.method(result.name).source_location
+ location, line = if result.respond_to?(:source_location)
+ result.source_location
+ else
+ result.method(result.name).source_location
+ end
+
"#{executable} #{relative_path_for(location)}:#{line}"
end
diff --git a/railties/test/test_unit/reporter_test.rb b/railties/test/test_unit/reporter_test.rb
index ad852d0f35..91cb47779b 100644
--- a/railties/test/test_unit/reporter_test.rb
+++ b/railties/test/test_unit/reporter_test.rb
@@ -163,7 +163,7 @@ class TestUnitReporterTest < ActiveSupport::TestCase
end
def failed_test
- ft = ExampleTest.new(:woot)
+ ft = Minitest::Result.from(ExampleTest.new(:woot))
ft.failures << begin
raise Minitest::Assertion, "boo"
rescue Minitest::Assertion => e
@@ -176,17 +176,17 @@ class TestUnitReporterTest < ActiveSupport::TestCase
error = ArgumentError.new("wups")
error.set_backtrace([ "some_test.rb:4" ])
- et = ExampleTest.new(:woot)
+ et = Minitest::Result.from(ExampleTest.new(:woot))
et.failures << Minitest::UnexpectedError.new(error)
et
end
def passing_test
- ExampleTest.new(:woot)
+ Minitest::Result.from(ExampleTest.new(:woot))
end
def skipped_test
- st = ExampleTest.new(:woot)
+ st = Minitest::Result.from(ExampleTest.new(:woot))
st.failures << begin
raise Minitest::Skip, "skipchurches, misstemples"
rescue Minitest::Assertion => e