summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-24 18:23:58 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-24 18:23:58 +0000
commit528735b955abd70aa76eefdfa9929447679f3b89 (patch)
treea0e6c065a580cff2c80388b7481ed686dc7157ab
parent55a8087f674b81bfc31192ce2e123108af0ea5d1 (diff)
downloadredmine-528735b955abd70aa76eefdfa9929447679f3b89.tar.gz
redmine-528735b955abd70aa76eefdfa9929447679f3b89.zip
Use subclasses method instead of class variable.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8977 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/enumeration.rb2
-rw-r--r--test/unit/enumeration_test.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb
index 826955cc8..d532c78be 100644
--- a/app/models/enumeration.rb
+++ b/app/models/enumeration.rb
@@ -98,7 +98,7 @@ class Enumeration < ActiveRecord::Base
#
# Note: subclasses is protected in ActiveRecord
def self.get_subclasses
- @@subclasses[Enumeration]
+ subclasses
end
# Does the +new+ Hash override the previous Enumeration?
diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb
index 5c03dc2fa..56be566e7 100644
--- a/test/unit/enumeration_test.rb
+++ b/test/unit/enumeration_test.rb
@@ -108,4 +108,15 @@ class EnumerationTest < ActiveSupport::TestCase
enumeration.parent = Enumeration.find(5)
assert enumeration.is_override?
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