diff --git a/language/defined_spec.rb b/language/defined_spec.rb index 34408c019..80ad1818b 100644 --- a/language/defined_spec.rb +++ b/language/defined_spec.rb @@ -900,6 +900,10 @@ defined?(DefinedSpecs::Undefined).should be_nil end + it "returns nil when the constant is not defined and the outer module implements .const_missing" do + defined?(DefinedSpecs::ModuleWithConstMissing::Undefined).should be_nil + end + it "does not call .const_missing if the constant is not defined" do DefinedSpecs.should_not_receive(:const_missing) defined?(DefinedSpecs::UnknownChild).should be_nil diff --git a/language/fixtures/defined.rb b/language/fixtures/defined.rb index a9552619b..3761cfa5b 100644 --- a/language/fixtures/defined.rb +++ b/language/fixtures/defined.rb @@ -285,6 +285,12 @@ def method_no_args end end + module ModuleWithConstMissing + def self.const_missing(const) + const + end + end + class SuperWithIntermediateModules include IntermediateModule1 include IntermediateModule2