By default, only show statuses that are used by the tracker on the workflow edit view.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3188 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-12-18 15:41:32 +00:00
parent 6a369f28dd
commit 6bf0723d06
40 changed files with 114 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ require 'workflows_controller'
class WorkflowsController; def rescue_action(e) raise e end; end
class WorkflowsControllerTest < ActionController::TestCase
fixtures :roles, :trackers, :workflows, :users
fixtures :roles, :trackers, :workflows, :users, :issue_statuses
def setup
@controller = WorkflowsController.new
@@ -51,18 +51,46 @@ class WorkflowsControllerTest < ActionController::TestCase
end
def test_get_edit_with_role_and_tracker
Workflow.delete_all
Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 3)
Workflow.create!(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 5)
get :edit, :role_id => 2, :tracker_id => 1
assert_response :success
assert_template 'edit'
# used status only
assert_not_nil assigns(:statuses)
assert_equal [2, 3, 5], assigns(:statuses).collect(&:id)
# allowed transitions
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[2][]',
:value => '1',
:name => 'issue_status[3][]',
:value => '5',
:checked => 'checked' }
# not allowed
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[2][]',
:value => '3',
:name => 'issue_status[3][]',
:value => '2',
:checked => nil }
# unused
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[4][]' }
end
def test_get_edit_with_role_and_tracker_and_all_statuses
Workflow.delete_all
get :edit, :role_id => 2, :tracker_id => 1, :used_statuses_only => '0'
assert_response :success
assert_template 'edit'
assert_not_nil assigns(:statuses)
assert_equal IssueStatus.count, assigns(:statuses).size
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'issue_status[1][]',
:value => '1',
:checked => nil }
end