Skip to content

Commit d61a24c

Browse files
ahmadsheriferegon
authored andcommitted
Add a spec for rb_define_class_under when given a mismatched superclass
1 parent 4e64448 commit d61a24c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

optional/capi/class_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@
239239

240240
ClassUnderAutoload.name.should == "ClassUnderAutoload"
241241
end
242+
243+
it "raises a TypeError if class is defined and its superclass mismatches the given one" do
244+
lambda { @s.rb_define_class_under(CApiClassSpecs, "Sub", nil) }.should raise_error(TypeError)
245+
end
242246
end
243247

244248
describe "rb_define_class_variable" do

0 commit comments

Comments
 (0)