summaryrefslogtreecommitdiff
path: root/spec/ruby/language/module_spec.rb
diff options
context:
space:
mode:
authorAndrew Konchin <andry.konchin@gmail.com>2025-03-26 19:56:40 +0200
committerBenoit Daloze <eregontp@gmail.com>2025-03-27 11:09:24 +0100
commitbac22c985ecc7e4309b5b5e5ae1074c81319e889 (patch)
tree5c164d3ed99240737205068f612d47496487758e /spec/ruby/language/module_spec.rb
parent53a930f1570c81d2f7829f932e8d7ad67e8462b8 (diff)
Update to ruby/spec@5e579e2
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12984
Diffstat (limited to 'spec/ruby/language/module_spec.rb')
-rw-r--r--spec/ruby/language/module_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/language/module_spec.rb b/spec/ruby/language/module_spec.rb
index fffcf9c90d..0bfd148868 100644
--- a/spec/ruby/language/module_spec.rb
+++ b/spec/ruby/language/module_spec.rb
@@ -26,12 +26,16 @@ describe "The module keyword" do
it "reopens an existing module" do
module ModuleSpecs; Reopened = true; end
ModuleSpecs::Reopened.should be_true
+ ensure
+ ModuleSpecs.send(:remove_const, :Reopened)
end
ruby_version_is '3.2' do
it "does not reopen a module included in Object" do
module IncludedModuleSpecs; Reopened = true; end
ModuleSpecs::IncludedInObject::IncludedModuleSpecs.should_not == Object::IncludedModuleSpecs
+ ensure
+ IncludedModuleSpecs.send(:remove_const, :Reopened)
end
end
@@ -76,6 +80,8 @@ describe "Assigning an anonymous module to a constant" do
::ModuleSpecs_CS1 = mod
mod.name.should == "ModuleSpecs_CS1"
+ ensure
+ Object.send(:remove_const, :ModuleSpecs_CS1)
end
it "sets the name of a module scoped by an anonymous module" do
@@ -96,5 +102,7 @@ describe "Assigning an anonymous module to a constant" do
b.name.should == "ModuleSpecs_CS2::B"
c.name.should == "ModuleSpecs_CS2::B::C"
d.name.should == "ModuleSpecs_CS2::D"
+ ensure
+ Object.send(:remove_const, :ModuleSpecs_CS2)
end
end