##// END OF EJS Templates
Added tests to cover IssueStatus.destroy and IssueStatus.check_integrity...
Eric Davis -
r1921:cf1ad65cd261
parent child
Show More
@@ -1,56 +1,69
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.dirname(__FILE__) + '/../test_helper'
19 19
20 20 class IssueStatusTest < Test::Unit::TestCase
21 fixtures :issue_statuses
21 fixtures :issue_statuses, :issues
22 22
23 23 def test_create
24 24 status = IssueStatus.new :name => "Assigned"
25 25 assert !status.save
26 26 # status name uniqueness
27 27 assert_equal 1, status.errors.count
28 28
29 29 status.name = "Test Status"
30 30 assert status.save
31 31 assert !status.is_default
32 32 end
33 33
34 def test_destroy
35 count_before = IssueStatus.count
36 status = IssueStatus.find(3)
37 assert status.destroy
38 assert_equal count_before - 1, IssueStatus.count
39 end
40
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 }
45 end
46
34 47 def test_default
35 48 status = IssueStatus.default
36 49 assert_kind_of IssueStatus, status
37 50 end
38 51
39 52 def test_change_default
40 53 status = IssueStatus.find(2)
41 54 assert !status.is_default
42 55 status.is_default = true
43 56 assert status.save
44 57 status.reload
45 58
46 59 assert_equal status, IssueStatus.default
47 60 assert !IssueStatus.find(1).is_default
48 61 end
49 62
50 63 def test_reorder_should_not_clear_default_status
51 64 status = IssueStatus.default
52 65 status.move_to_bottom
53 66 status.reload
54 67 assert status.is_default?
55 68 end
56 69 end
General Comments 0
You need to be logged in to leave comments. Login now