mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Add a new spec for const_added
This commit is contained in:
parent
6d0dd7d863
commit
80cf292c79
Notes:
git
2025-04-23 05:10:31 +00:00
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue