mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Reorganize Module#autoload to have similar specs next to each other
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a8c358b704
commit
578e760a8b
1 changed files with 16 additions and 20 deletions
|
@ -335,6 +335,22 @@ describe "Module#autoload" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "when changing $LOAD_PATH" do
|
||||||
|
before do
|
||||||
|
$LOAD_PATH.unshift(File.expand_path('../fixtures/path1', __FILE__))
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
$LOAD_PATH.shift
|
||||||
|
$LOAD_PATH.shift
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not reload a file due to a different load path" do
|
||||||
|
ModuleSpecs::Autoload.autoload :LoadPath, "load_path"
|
||||||
|
ModuleSpecs::Autoload::LoadPath.loaded.should == :autoload_load_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "(concurrently)" do
|
describe "(concurrently)" do
|
||||||
it "blocks a second thread while a first is doing the autoload" do
|
it "blocks a second thread while a first is doing the autoload" do
|
||||||
ModuleSpecs::Autoload.autoload :Concur, fixture(__FILE__, "autoload_concur.rb")
|
ModuleSpecs::Autoload.autoload :Concur, fixture(__FILE__, "autoload_concur.rb")
|
||||||
|
@ -383,27 +399,7 @@ describe "Module#autoload" do
|
||||||
|
|
||||||
ModuleSpecs::Autoload.send(:remove_const, :Concur)
|
ModuleSpecs::Autoload.send(:remove_const, :Concur)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
describe "when changing $LOAD_PATH" do
|
|
||||||
|
|
||||||
before do
|
|
||||||
$LOAD_PATH.unshift(File.expand_path('../fixtures/path1', __FILE__))
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
$LOAD_PATH.shift
|
|
||||||
$LOAD_PATH.shift
|
|
||||||
end
|
|
||||||
|
|
||||||
it "does not reload a file due to a different load path" do
|
|
||||||
ModuleSpecs::Autoload.autoload :LoadPath, "load_path"
|
|
||||||
ModuleSpecs::Autoload::LoadPath.loaded.should == :autoload_load_path
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "(concurrently)" do
|
|
||||||
ruby_bug "#10892", ""..."2.3" do
|
ruby_bug "#10892", ""..."2.3" do
|
||||||
it "blocks others threads while doing an autoload" do
|
it "blocks others threads while doing an autoload" do
|
||||||
file_path = fixture(__FILE__, "repeated_concurrent_autoload.rb")
|
file_path = fixture(__FILE__, "repeated_concurrent_autoload.rb")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue