diff options
author | Benoit Daloze <eregontp@gmail.com> | 2021-07-29 22:11:21 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2021-07-29 22:11:21 +0200 |
commit | 6998d758248d778fa95b008c78d05473e48b8428 (patch) | |
tree | 8abc6926f647ea5f374a5b34c3a4820c5861e32e /spec/ruby/core/kernel/autoload_spec.rb | |
parent | 15d05f8120745a121b93fab9fd2addf5f094e8d2 (diff) |
Update to ruby/spec@b65d01f
Diffstat (limited to 'spec/ruby/core/kernel/autoload_spec.rb')
-rw-r--r-- | spec/ruby/core/kernel/autoload_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/autoload_spec.rb b/spec/ruby/core/kernel/autoload_spec.rb index 8d56021fa8..0404caec6d 100644 --- a/spec/ruby/core/kernel/autoload_spec.rb +++ b/spec/ruby/core/kernel/autoload_spec.rb @@ -56,6 +56,21 @@ describe "Kernel#autoload" do end end + describe "inside a Class.new method body" do + # NOTE: this spec is being discussed in https://github.com/ruby/spec/pull/839 + it "should define on the new anonymous class" do + cls = Class.new do + def go + autoload :Object, 'bogus' + autoload? :Object + end + end + + cls.new.go.should == 'bogus' + cls.autoload?(:Object).should == 'bogus' + end + end + describe "when Object is frozen" do it "raises a FrozenError before defining the constant" do ruby_exe(fixture(__FILE__, "autoload_frozen.rb")).should == "FrozenError - nil" |