Skip to content

Commit

Permalink
Add subclasses specs for more prepend/include cases
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Feb 26, 2024
1 parent 9565562 commit 2a786c4
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion spec/ruby/core/class/subclasses_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
assert_subclasses(ModuleSpecs::Parent, [ModuleSpecs::Child, ModuleSpecs::Child2])
end

it "does not return included modules" do
it "does not return included modules from the parent" do
parent = Class.new
child = Class.new(parent)
mod = Module.new
Expand All @@ -16,6 +16,33 @@
assert_subclasses(parent, [child])
end

it "does not return included modules from the child" do
parent = Class.new
child = Class.new(parent)
mod = Module.new
parent.include(mod)

assert_subclasses(parent, [child])
end

it "does not return prepended modules from the parent" do
parent = Class.new
child = Class.new(parent)
mod = Module.new
parent.prepend(mod)

assert_subclasses(parent, [child])
end

it "does not return prepended modules from the child" do
parent = Class.new
child = Class.new(parent)
mod = Module.new
child.prepend(mod)

assert_subclasses(parent, [child])
end

it "does not return singleton classes" do
a = Class.new

Expand Down

0 comments on commit 2a786c4

Please sign in to comment.