Skip to content

Commit

Permalink
Specs for Kernel#load accepting a module
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroProtagonist authored and eregon committed Oct 31, 2022
1 parent 1a4f0bd commit d203f64
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/kernel/shared/load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@
end
end

describe "when passed a module for 'wrap'" do
ruby_version_is "3.1" do
it "sets the enclosing scope to the supplied module" do
path = File.expand_path "wrap_fixture.rb", CODE_LOADING_DIR
mod = Module.new
@object.load(path, mod)

Object.const_defined?(:LoadSpecWrap).should be_false
mod.const_defined?(:LoadSpecWrap).should be_true

wrap_module = ScratchPad.recorded[1]
wrap_module.should == mod
end
end
end

describe "(shell expansion)" do
before :each do
@env_home = ENV["HOME"]
Expand Down

0 comments on commit d203f64

Please sign in to comment.