1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2018-08-03 16:19:40 +00:00
parent aeeaadaad0
commit b53cf149ad
246 changed files with 9108 additions and 548 deletions

View file

@ -7,7 +7,7 @@ require_relative 'fixtures/classes'
autoload :KSAutoloadA, "autoload_a.rb"
autoload :KSAutoloadB, fixture(__FILE__, "autoload_b.rb")
autoload :KSAutoloadC, fixture(__FILE__, "autoload_c.rb")
autoload :KSAutoloadCallsRequire, "main_autoload_not_exist.rb"
def check_autoload(const)
autoload? const
@ -42,10 +42,11 @@ describe "Kernel#autoload" do
KSAutoloadB.loaded.should == :ksautoload_b
end
it "does not call Kernel.require or Kernel.load to load the file" do
Kernel.should_not_receive(:require)
Kernel.should_not_receive(:load)
KSAutoloadC.loaded.should == :ksautoload_c
it "calls main.require(path) to load the file" do
main = TOPLEVEL_BINDING.eval("self")
main.should_receive(:require).with("main_autoload_not_exist.rb")
# The constant won't be defined since require is mocked to do nothing
-> { KSAutoloadCallsRequire }.should raise_error(NameError)
end
it "can autoload in instance_eval" do