]> source.dussan.org Git - redmine.git/commitdiff
Use subclasses method instead of class variable.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 24 Feb 2012 18:23:58 +0000 (18:23 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 24 Feb 2012 18:23:58 +0000 (18:23 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8977 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/enumeration.rb
test/unit/enumeration_test.rb

index 826955cc8186830481990a2115dd3c1dec85ab99..d532c78beee8206066e7fcde7a0215bea0361595 100644 (file)
@@ -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?
index 5c03dc2faac31e2f7176d9e24cd743212ab800ed..56be566e748b823a225fce4c8860d9f6307454e7 100644 (file)
@@ -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