File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,11 @@ def self.get_class_name
126126 DEFINE_CLASS = -> do
127127 class ::A ; end
128128 end
129+
130+ module IncludedInObjectWithClass
131+ class IncludedClassSpecs
132+ end
133+ end
129134end
130135
131136class Class
@@ -137,6 +142,8 @@ def example_instance_method_of_singleton_class; end
137142 def self . example_class_method_of_singleton_class ; end
138143end
139144class Object
145+ include ClassSpecs ::IncludedInObjectWithClass
146+
140147 def example_instance_method_of_object ; end
141148 def self . example_class_method_of_object ; end
142149end
Original file line number Diff line number Diff line change @@ -46,7 +46,14 @@ class ClassSpecsKeywordWithSemicolon; end
4646 -> {
4747 class ClassSpecsNumber
4848 end
49- } . should raise_error ( TypeError )
49+ } . should raise_error ( TypeError , /\A ClassSpecsNumber is not a class/ )
50+ end
51+
52+ it "raises TypeError if constant given as class name exists and is not a Class" do
53+ -> {
54+ class ClassSpecs ::IncludedInObjectWithClass
55+ end
56+ } . should raise_error ( TypeError , /\A IncludedInObjectWithClass is not a class/ )
5057 end
5158
5259 # test case known to be detecting bugs (JRuby, MRI)
@@ -346,6 +353,11 @@ def self.m
346353 ClassSpecs ::M . m . should == 1
347354 ClassSpecs ::L . singleton_class . send ( :remove_method , :m )
348355 end
356+
357+ it "does not reopen a class included in Object" do
358+ class IncludedClassSpecs ; end
359+ ClassSpecs ::IncludedInObjectWithClass ::IncludedClassSpecs . should_not == Object ::IncludedClassSpecs
360+ end
349361end
350362
351363describe "class provides hooks" do
You can’t perform that action at this time.
0 commit comments