Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specs for Kernel#load accepting a module #973

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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