Use subclasses method instead of class variable.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8977 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
55a8087f67
commit
528735b955
|
@ -98,7 +98,7 @@ class Enumeration < ActiveRecord::Base
|
||||||
#
|
#
|
||||||
# Note: subclasses is protected in ActiveRecord
|
# Note: subclasses is protected in ActiveRecord
|
||||||
def self.get_subclasses
|
def self.get_subclasses
|
||||||
@@subclasses[Enumeration]
|
subclasses
|
||||||
end
|
end
|
||||||
|
|
||||||
# Does the +new+ Hash override the previous Enumeration?
|
# Does the +new+ Hash override the previous Enumeration?
|
||||||
|
|
|
@ -108,4 +108,15 @@ class EnumerationTest < ActiveSupport::TestCase
|
||||||
enumeration.parent = Enumeration.find(5)
|
enumeration.parent = Enumeration.find(5)
|
||||||
assert enumeration.is_override?
|
assert enumeration.is_override?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_get_subclasses
|
||||||
|
classes = Enumeration.get_subclasses
|
||||||
|
assert_include IssuePriority, classes
|
||||||
|
assert_include DocumentCategory, classes
|
||||||
|
assert_include TimeEntryActivity, classes
|
||||||
|
|
||||||
|
classes.each do |klass|
|
||||||
|
assert_equal Enumeration, klass.superclass
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue