diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-02-20 15:38:07 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-02-20 15:38:07 +0000 |
commit | 4b096e9a56768dd5ba15304a903939f4e5e62e22 (patch) | |
tree | 032fb0361f6834929b0509a575ec1abcd7ba9da8 /test/unit/issue_status_test.rb | |
parent | 7ddb1c694aaee2c36b0e3e67043f626903e0c961 (diff) | |
download | redmine-4b096e9a56768dd5ba15304a903939f4e5e62e22.tar.gz redmine-4b096e9a56768dd5ba15304a903939f4e5e62e22.zip |
Allow additional workflow transitions for issue author and assignee (#2732).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4895 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_status_test.rb')
-rw-r--r-- | test/unit/issue_status_test.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/unit/issue_status_test.rb b/test/unit/issue_status_test.rb index 4fc6de1e2..bc6535edc 100644 --- a/test/unit/issue_status_test.rb +++ b/test/unit/issue_status_test.rb @@ -18,7 +18,7 @@ require File.expand_path('../../test_helper', __FILE__) class IssueStatusTest < ActiveSupport::TestCase - fixtures :issue_statuses, :issues + fixtures :issue_statuses, :issues, :roles, :trackers def test_create status = IssueStatus.new :name => "Assigned" @@ -68,6 +68,30 @@ class IssueStatusTest < ActiveSupport::TestCase status.reload assert status.is_default? end + + def test_new_statuses_allowed_to + Workflow.delete_all + + Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false) + Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3, :author => true, :assignee => false) + Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true) + Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 5, :author => true, :assignee => true) + status = IssueStatus.find(1) + role = Role.find(1) + tracker = Tracker.find(1) + + assert_equal [2], status.new_statuses_allowed_to([role], tracker, false, false).map(&:id) + assert_equal [2], status.find_new_statuses_allowed_to([role], tracker, false, false).map(&:id) + + assert_equal [2, 3], status.new_statuses_allowed_to([role], tracker, true, false).map(&:id) + assert_equal [2, 3], status.find_new_statuses_allowed_to([role], tracker, true, false).map(&:id) + + assert_equal [2, 4], status.new_statuses_allowed_to([role], tracker, false, true).map(&:id) + assert_equal [2, 4], status.find_new_statuses_allowed_to([role], tracker, false, true).map(&:id) + + assert_equal [2, 3, 4, 5], status.new_statuses_allowed_to([role], tracker, true, true).map(&:id) + assert_equal [2, 3, 4, 5], status.find_new_statuses_allowed_to([role], tracker, true, true).map(&:id) + end context "#update_done_ratios" do setup do |