MiniTest::Unit.options has default :seed

MiniTest::Unit (superclass of Test::Unit::Runner) does not has
default seed parameter, but assigned after initializing.
However some tests use MiniTest::Unit without setup of seed option
and it cases unexpected test failures. To solve this issue, add
default seed parameter 42.
This commit is contained in:
Koichi Sasada 2020-02-27 04:06:28 +09:00
Родитель 14f1790807
Коммит 6b30638bdb
2 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -763,7 +763,7 @@ module MiniTest
# Lazy accessor for options.
def options
@options ||= {}
@options ||= {seed: 42}
end
@@installed_at_exit ||= false

Просмотреть файл

@ -47,7 +47,6 @@ class MetaMetaMetaTestCase < MiniTest::Unit::TestCase
srand 42
MiniTest::Unit::TestCase.reset
@tu = MiniTest::Unit.new
@tu.options[:seed] = 42
MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
end