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
This commit is contained in:
Jean-Philippe Lang
2011-02-20 15:38:07 +00:00
parent 7ddb1c694a
commit 4b096e9a56
11 changed files with 221 additions and 83 deletions
+36 -8
View File
@@ -65,17 +65,17 @@ class WorkflowsControllerTest < ActionController::TestCase
# allowed transitions
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[3][]',
:value => '5',
:name => 'issue_status[3][5][]',
:value => 'always',
:checked => 'checked' }
# not allowed
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[3][]',
:value => '2',
:name => 'issue_status[3][2][]',
:value => 'always',
:checked => nil }
# unused
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[4][]' }
:name => 'issue_status[1][1][]' }
end
def test_get_edit_with_role_and_tracker_and_all_statuses
@@ -89,13 +89,17 @@ class WorkflowsControllerTest < ActionController::TestCase
assert_equal IssueStatus.count, assigns(:statuses).size
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[1][]',
:value => '1',
:name => 'issue_status[1][1][]',
:value => 'always',
:checked => nil }
end
def test_post_edit
post :edit, :role_id => 2, :tracker_id => 1, :issue_status => {'4' => ['5'], '3' => ['1', '2']}
post :edit, :role_id => 2, :tracker_id => 1,
:issue_status => {
'4' => {'5' => ['always']},
'3' => {'1' => ['always'], '2' => ['always']}
}
assert_redirected_to '/workflows/edit?role_id=2&tracker_id=1'
assert_equal 3, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2})
@@ -103,6 +107,30 @@ class WorkflowsControllerTest < ActionController::TestCase
assert_nil Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4})
end
def test_post_edit_with_additional_transitions
post :edit, :role_id => 2, :tracker_id => 1,
:issue_status => {
'4' => {'5' => ['always']},
'3' => {'1' => ['author'], '2' => ['assignee'], '4' => ['author', 'assignee']}
}
assert_redirected_to '/workflows/edit?role_id=2&tracker_id=1'
assert_equal 4, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2})
w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 4, :new_status_id => 5})
assert ! w.author
assert ! w.assignee
w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 1})
assert w.author
assert ! w.assignee
w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2})
assert ! w.author
assert w.assignee
w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 4})
assert w.author
assert w.assignee
end
def test_clear_workflow
assert Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) > 0