Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invoke Module#const_set before Class#inherited (#1838)
- Loading branch information
1 parent
1976f66
commit 9e5e9ba
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module ModuleInheritedTestModule | ||
class A | ||
def self.inherited(subclass) | ||
$ScratchPad << subclass.name | ||
end | ||
end | ||
end | ||
|
||
describe 'Class#inherited' do | ||
it 'gets called after setting a base scope of the subclass' do | ||
$ScratchPad = [] | ||
module ModuleInheritedTestModule | ||
class B < A | ||
end | ||
end | ||
$ScratchPad.should == ['ModuleInheritedTestModule::B'] | ||
end | ||
end |