diff options
author | Jeremy Evans <code@jeremyevans.net> | 2021-12-20 08:26:14 -0800 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2021-12-20 11:02:15 -0800 |
commit | 3bd5f27f737c7d365b7d01c43d77a958c224ab16 (patch) | |
tree | 2e3933d29fc01a17999c3664969017df77a998a0 /spec | |
parent | c57ac4c6e0acf9b4c1fbb3092eefc89873c5d249 (diff) | |
download | ruby-3bd5f27f737c7d365b7d01c43d77a958c224ab16.tar.gz |
Remove Class#descendants
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/core/class/descendants_spec.rb | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/spec/ruby/core/class/descendants_spec.rb b/spec/ruby/core/class/descendants_spec.rb deleted file mode 100644 index f87cd68be8..0000000000 --- a/spec/ruby/core/class/descendants_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require_relative '../../spec_helper' -require_relative '../module/fixtures/classes' - -ruby_version_is '3.1' do - describe "Class#descendants" do - it "returns a list of classes descended from self (excluding self)" do - assert_descendants(ModuleSpecs::Parent, [ModuleSpecs::Child, ModuleSpecs::Child2, ModuleSpecs::Grandchild]) - end - - it "does not return included modules" do - parent = Class.new - child = Class.new(parent) - mod = Module.new - parent.include(mod) - - assert_descendants(parent, [child]) - end - - it "does not return singleton classes" do - a = Class.new - - a_obj = a.new - def a_obj.force_singleton_class - 42 - end - - a.descendants.should_not include(a_obj.singleton_class) - end - - it "has 1 entry per module or class" do - ModuleSpecs::Parent.descendants.should == ModuleSpecs::Parent.descendants.uniq - end - - def assert_descendants(mod, descendants) - mod.descendants.sort_by(&:inspect).should == descendants.sort_by(&:inspect) - end - end -end |