summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/core/module/const_added_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/ruby/core/module/const_added_spec.rb b/spec/ruby/core/module/const_added_spec.rb
index 1b3dad514b..dfa2e011cc 100644
--- a/spec/ruby/core/module/const_added_spec.rb
+++ b/spec/ruby/core/module/const_added_spec.rb
@@ -219,5 +219,20 @@ describe "Module#const_added" do
ScratchPad.recorded.should == [:const_added, :inherited]
end
+
+ it "the superclass of a class assigned to a constant is set before const_added is called" do
+ ScratchPad.record []
+
+ parent = Class.new do
+ def self.const_added(name)
+ ScratchPad << name
+ ScratchPad << const_get(name).superclass
+ end
+ end
+
+ class parent::C < parent; end
+
+ ScratchPad.recorded.should == [:C, parent]
+ end
end
end