Mercurial > hg > soundsoftware-site
comparison test/unit/issue_status_test.rb @ 524:1248a47e81b3 feature_36
Merge from branch "luisf"
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Mon, 25 Jul 2011 14:39:38 +0100 |
parents | 051f544170fe |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
519:3be6bc3c2a17 | 524:1248a47e81b3 |
---|---|
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. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../test_helper' | 18 require File.expand_path('../../test_helper', __FILE__) |
19 | 19 |
20 class IssueStatusTest < ActiveSupport::TestCase | 20 class IssueStatusTest < ActiveSupport::TestCase |
21 fixtures :issue_statuses, :issues | 21 fixtures :issue_statuses, :issues, :roles, :trackers |
22 | 22 |
23 def test_create | 23 def test_create |
24 status = IssueStatus.new :name => "Assigned" | 24 status = IssueStatus.new :name => "Assigned" |
25 assert !status.save | 25 assert !status.save |
26 # status name uniqueness | 26 # status name uniqueness |
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 | |
72 def test_new_statuses_allowed_to | |
73 Workflow.delete_all | |
74 | |
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) | |
77 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true) | |
78 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 5, :author => true, :assignee => true) | |
79 status = IssueStatus.find(1) | |
80 role = Role.find(1) | |
81 tracker = Tracker.find(1) | |
82 | |
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) | |
85 | |
86 assert_equal [2, 3], status.new_statuses_allowed_to([role], tracker, true, false).map(&:id) | |
87 assert_equal [2, 3], status.find_new_statuses_allowed_to([role], tracker, true, false).map(&:id) | |
88 | |
89 assert_equal [2, 4], status.new_statuses_allowed_to([role], tracker, false, true).map(&:id) | |
90 assert_equal [2, 4], status.find_new_statuses_allowed_to([role], tracker, false, true).map(&:id) | |
91 | |
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) | |
94 end | |
71 | 95 |
72 context "#update_done_ratios" do | 96 context "#update_done_ratios" do |
73 setup do | 97 setup do |
74 @issue = Issue.find(1) | 98 @issue = Issue.find(1) |
75 @issue_status = IssueStatus.find(1) | 99 @issue_status = IssueStatus.find(1) |