forked from flipsasser/maintain
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug with subclasses not inheriting parents' maintainers
- Loading branch information
Flip Sasser
committed
Feb 28, 2011
1 parent
f0912f0
commit 64dbdae
Showing
3 changed files
with
67 additions
and
25 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
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,37 @@ | ||
# Basic class method specs | ||
|
||
require 'lib/maintain' | ||
|
||
describe Maintain do | ||
before :each do | ||
class ::MaintainTest | ||
attr_accessor :existant_attribute | ||
extend Maintain | ||
end | ||
|
||
class ::MaintainTestSubclass < ::MaintainTest; end | ||
end | ||
|
||
it "should inherit maintainers from parent classes" do | ||
MaintainTest.maintain :status do | ||
state :new | ||
state :old | ||
end | ||
MaintainTestSubclass.maintainers[:status].should_not be_nil | ||
end | ||
|
||
it "should not propagate maintainers up the class system" do | ||
MaintainTest.maintain :status do | ||
state :new | ||
state :old | ||
end | ||
MaintainTestSubclass.maintain :foo do | ||
state :bar | ||
state :baz | ||
end | ||
MaintainTest.maintainers[:foo].should be_nil | ||
MaintainTestSubclass.maintainers[:status].should_not be_nil | ||
end | ||
|
||
|
||
end |