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 authored and andrykonchin committed Apr 1, 2024
1 parent eef6056 commit 573cf97
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion core/class/subclasses_spec.rb
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 573cf97

Please sign in to comment.