##// END OF EJS Templates
remove trailing white-spaces from test/unit/issue_status_test.rb....
Toshi MARUYAMA -
r6627:a00e391a9908
parent child
Show More
@@ -1,16 +1,16
1 # redMine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
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
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.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -25,12 +25,12 class IssueStatusTest < ActiveSupport::TestCase
25 assert !status.save
25 assert !status.save
26 # status name uniqueness
26 # status name uniqueness
27 assert_equal 1, status.errors.count
27 assert_equal 1, status.errors.count
28
28
29 status.name = "Test Status"
29 status.name = "Test Status"
30 assert status.save
30 assert status.save
31 assert !status.is_default
31 assert !status.is_default
32 end
32 end
33
33
34 def test_destroy
34 def test_destroy
35 status = IssueStatus.find(3)
35 status = IssueStatus.find(3)
36 assert_difference 'IssueStatus.count', -1 do
36 assert_difference 'IssueStatus.count', -1 do
@@ -50,28 +50,28 class IssueStatusTest < ActiveSupport::TestCase
50 status = IssueStatus.default
50 status = IssueStatus.default
51 assert_kind_of IssueStatus, status
51 assert_kind_of IssueStatus, status
52 end
52 end
53
53
54 def test_change_default
54 def test_change_default
55 status = IssueStatus.find(2)
55 status = IssueStatus.find(2)
56 assert !status.is_default
56 assert !status.is_default
57 status.is_default = true
57 status.is_default = true
58 assert status.save
58 assert status.save
59 status.reload
59 status.reload
60
60
61 assert_equal status, IssueStatus.default
61 assert_equal status, IssueStatus.default
62 assert !IssueStatus.find(1).is_default
62 assert !IssueStatus.find(1).is_default
63 end
63 end
64
64
65 def test_reorder_should_not_clear_default_status
65 def test_reorder_should_not_clear_default_status
66 status = IssueStatus.default
66 status = IssueStatus.default
67 status.move_to_bottom
67 status.move_to_bottom
68 status.reload
68 status.reload
69 assert status.is_default?
69 assert status.is_default?
70 end
70 end
71
71
72 def test_new_statuses_allowed_to
72 def test_new_statuses_allowed_to
73 Workflow.delete_all
73 Workflow.delete_all
74
74
75 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false)
75 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false)
76 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3, :author => true, :assignee => false)
76 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3, :author => true, :assignee => false)
77 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true)
77 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true)
@@ -82,13 +82,13 class IssueStatusTest < ActiveSupport::TestCase
82
82
83 assert_equal [2], status.new_statuses_allowed_to([role], tracker, false, false).map(&:id)
83 assert_equal [2], status.new_statuses_allowed_to([role], tracker, false, false).map(&:id)
84 assert_equal [2], status.find_new_statuses_allowed_to([role], tracker, false, false).map(&:id)
84 assert_equal [2], status.find_new_statuses_allowed_to([role], tracker, false, false).map(&:id)
85
85
86 assert_equal [2, 3, 5], status.new_statuses_allowed_to([role], tracker, true, false).map(&:id)
86 assert_equal [2, 3, 5], status.new_statuses_allowed_to([role], tracker, true, false).map(&:id)
87 assert_equal [2, 3, 5], status.find_new_statuses_allowed_to([role], tracker, true, false).map(&:id)
87 assert_equal [2, 3, 5], status.find_new_statuses_allowed_to([role], tracker, true, false).map(&:id)
88
88
89 assert_equal [2, 4, 5], status.new_statuses_allowed_to([role], tracker, false, true).map(&:id)
89 assert_equal [2, 4, 5], status.new_statuses_allowed_to([role], tracker, false, true).map(&:id)
90 assert_equal [2, 4, 5], status.find_new_statuses_allowed_to([role], tracker, false, true).map(&:id)
90 assert_equal [2, 4, 5], status.find_new_statuses_allowed_to([role], tracker, false, true).map(&:id)
91
91
92 assert_equal [2, 3, 4, 5], status.new_statuses_allowed_to([role], tracker, true, true).map(&:id)
92 assert_equal [2, 3, 4, 5], status.new_statuses_allowed_to([role], tracker, true, true).map(&:id)
93 assert_equal [2, 3, 4, 5], status.find_new_statuses_allowed_to([role], tracker, true, true).map(&:id)
93 assert_equal [2, 3, 4, 5], status.find_new_statuses_allowed_to([role], tracker, true, true).map(&:id)
94 end
94 end
@@ -99,12 +99,12 class IssueStatusTest < ActiveSupport::TestCase
99 @issue_status = IssueStatus.find(1)
99 @issue_status = IssueStatus.find(1)
100 @issue_status.update_attribute(:default_done_ratio, 50)
100 @issue_status.update_attribute(:default_done_ratio, 50)
101 end
101 end
102
102
103 context "with Setting.issue_done_ratio using the issue_field" do
103 context "with Setting.issue_done_ratio using the issue_field" do
104 setup do
104 setup do
105 Setting.issue_done_ratio = 'issue_field'
105 Setting.issue_done_ratio = 'issue_field'
106 end
106 end
107
107
108 should "change nothing" do
108 should "change nothing" do
109 IssueStatus.update_issue_done_ratios
109 IssueStatus.update_issue_done_ratios
110
110
@@ -116,10 +116,10 class IssueStatusTest < ActiveSupport::TestCase
116 setup do
116 setup do
117 Setting.issue_done_ratio = 'issue_status'
117 Setting.issue_done_ratio = 'issue_status'
118 end
118 end
119
119
120 should "update all of the issue's done_ratios to match their Issue Status" do
120 should "update all of the issue's done_ratios to match their Issue Status" do
121 IssueStatus.update_issue_done_ratios
121 IssueStatus.update_issue_done_ratios
122
122
123 issues = Issue.find([1,3,4,5,6,7,9,10])
123 issues = Issue.find([1,3,4,5,6,7,9,10])
124 issues.each do |issue|
124 issues.each do |issue|
125 assert_equal @issue_status, issue.status
125 assert_equal @issue_status, issue.status
General Comments 0
You need to be logged in to leave comments. Login now