summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_priority_test.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-05-30 23:30:36 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-05-30 23:30:36 +0000
commit62e58f26b0c6905fc0b2d79ed278ac0e4f55d793 (patch)
tree6989cbc655e9ffee0db9b7558985cd77d28b0edb /test/unit/issue_priority_test.rb
parentfbfb34949677c41734531a552547fb216537999f (diff)
downloadredmine-62e58f26b0c6905fc0b2d79ed278ac0e4f55d793.tar.gz
redmine-62e58f26b0c6905fc0b2d79ed278ac0e4f55d793.zip
Changed Enumerations to use a Single Table Inheritance
* Added migrations to change Enumerations to an STI relationship * Added TimeEntryActivity model (STI) * Added DocumentCategory model (STI) * Added IssuePriority model (STI) * Added Enumeration#get_subclasses to get a list of the subclasses of Enumeration * Changed Enumeration to use the STI type field instead of the opt field * Changed Enumeration#opt to return the old opt values but with a deprecation warning. * Removed Enumeration::OPTIONS * Removed the dynamic named_scopes in favor of specific named_scopes. Kept for compatibility reasons. * Added Enumeration#default so each subclass can easily find it's default record. * Fixed Enumeration#default to use the STI scoping with a fake default scope for finding Enumeration's default. * Added a 'all' named scope for getting all records in order by position. * Added Deprecation warnings to the old named_scopes in Enumerations. * Moved various methods off of Enumeration and onto the concrete classes * Changed the EnumerationsController to use types * Updated the Enumeration list template * Added has_many relationships to the Enumeration STI classes. * Fixes for tests. #3007 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2777 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_priority_test.rb')
-rw-r--r--test/unit/issue_priority_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb
new file mode 100644
index 000000000..e2da1e82d
--- /dev/null
+++ b/test/unit/issue_priority_test.rb
@@ -0,0 +1,38 @@
+# redMine - project management software
+# Copyright (C) 2006-2008 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class IssuePriorityTest < Test::Unit::TestCase
+ fixtures :enumerations, :issues
+
+ def test_should_be_an_enumeration
+ assert IssuePriority.ancestors.include?(Enumeration)
+ end
+
+ def test_objects_count
+ # low priority
+ assert_equal 5, IssuePriority.find(4).objects_count
+ # urgent
+ assert_equal 0, IssuePriority.find(7).objects_count
+ end
+
+ def test_option_name
+ assert_equal :enumeration_issue_priorities, IssuePriority.new.option_name
+ end
+end
+