Skip to content

Commit

Permalink
Added spec for Autoload#find_const for case XX::YY < YY
Browse files Browse the repository at this point in the history
  • Loading branch information
hosiawak committed Feb 28, 2012
1 parent 057326c commit b8a4cb8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/ruby/core/module/autoload_spec.rb
Expand Up @@ -243,6 +243,15 @@ class V
ModuleSpecs::Autoload::U::V::X.should == :autoload_uvx
end

it "loads the file that defines subclass XX::YY < YY and YY is a top level constant" do

module ModuleSpecs::Autoload::XX
autoload :YY, fixture(__FILE__, "autoload_subclass.rb")
end

ModuleSpecs::Autoload::XX::YY.superclass.should == YY
end

ruby_version_is "1.9" do
# [ruby-core:19127] [ruby-core:29941]
it "does NOT raise a NameError when the autoload file did not define the constant and a module is opened with the same name" do
Expand Down
11 changes: 11 additions & 0 deletions spec/ruby/core/module/fixtures/autoload_subclass.rb
@@ -0,0 +1,11 @@
class YY
end

module ModuleSpecs
module Autoload
module XX
class YY < YY
end
end
end
end

0 comments on commit b8a4cb8

Please sign in to comment.