1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 require File.dirname(__FILE__) + '/../test_helper'
20 class IssueStatusTest < ActiveSupport::TestCase
21 fixtures :issue_statuses, :issues
24 status = IssueStatus.new :name => "Assigned"
26 # status name uniqueness
27 assert_equal 1, status.errors.count
29 status.name = "Test Status"
31 assert !status.is_default
35 count_before = IssueStatus.count
36 status = IssueStatus.find(3)
38 assert_equal count_before - 1, IssueStatus.count
41 def test_destroy_status_in_use
42 # Status assigned to an Issue
43 status = Issue.find(1).status
44 assert_raise(RuntimeError, "Can't delete status") { status.destroy }
48 status = IssueStatus.default
49 assert_kind_of IssueStatus, status
52 def test_change_default
53 status = IssueStatus.find(2)
54 assert !status.is_default
55 status.is_default = true
59 assert_equal status, IssueStatus.default
60 assert !IssueStatus.find(1).is_default
63 def test_reorder_should_not_clear_default_status
64 status = IssueStatus.default
67 assert status.is_default?