Skip to content

Commit

Permalink
Remove cvar overtaken classes at end of test methods
Browse files Browse the repository at this point in the history
Fixes issues when the same tests are executed more than once,
which some CI machines do.
  • Loading branch information
jeremyevans committed Mar 10, 2021
1 parent cbc7c1c commit d9fea49
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/ruby/test_variable.rb
Expand Up @@ -96,6 +96,9 @@ class Parent
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
Expand Down Expand Up @@ -124,6 +127,9 @@ class ParentForModule
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
Expand Down

0 comments on commit d9fea49

Please sign in to comment.