summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2021-03-10 12:09:45 -0800
committerJeremy Evans <[email protected]>2021-03-10 12:09:45 -0800
commitd9fea496afed5a35d2f79ea3cac35176966dd471 (patch)
tree5d1c2e78d016cab7b11e30259658ef2567bd27ce
parentcbc7c1c06145b02b3d887a6fb2c3b6d9e4bb22dd (diff)
Remove cvar overtaken classes at end of test methods
Fixes issues when the same tests are executed more than once, which some CI machines do.
-rw-r--r--test/ruby/test_variable.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb
index bedddf0af7..f8a7c68fd3 100644
--- a/test/ruby/test_variable.rb
+++ b/test/ruby/test_variable.rb
@@ -96,6 +96,9 @@ class TestVariable < Test::Unit::TestCase
EORB
assert_equal "class variable @@cvar of TestVariable::Child is overtaken by TestVariable::Parent", error.message
+ ensure
+ TestVariable.send(:remove_const, :Child) rescue nil
+ TestVariable.send(:remove_const, :Parent) rescue nil
end
def test_cvar_overtaken_by_module
@@ -124,6 +127,9 @@ class TestVariable < Test::Unit::TestCase
EORB
assert_equal "class variable @@cvar of TestVariable::ParentForModule is overtaken by TestVariable::Mixin", error.message
+ ensure
+ TestVariable.send(:remove_const, :Mixin) rescue nil
+ TestVariable.send(:remove_const, :ParentForModule) rescue nil
end
class IncludeRefinedModuleClassVariableNoWarning