Skip to content

Commit

Permalink
MiniTest::Unit.options has default :seed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ko1 committed Feb 26, 2020
1 parent 14f1790 commit 6b30638
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion tool/lib/minitest/unit.rb
Expand Up @@ -763,7 +763,7 @@ class Unit # :nodoc:
# Lazy accessor for options.

def options
@options ||= {}
@options ||= {seed: 42}
end

@@installed_at_exit ||= false
Expand Down
1 change: 0 additions & 1 deletion tool/test/minitest/metametameta.rb
Expand Up @@ -47,7 +47,6 @@ def setup
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
Expand Down

0 comments on commit 6b30638

Please sign in to comment.