Mercurial > hg > soundsoftware-site
diff test/functional/.svn/text-base/workflows_controller_test.rb.svn-base @ 245:051f544170fe
* Update to SVN trunk revision 4993
author | Chris Cannam |
---|---|
date | Thu, 03 Mar 2011 11:42:28 +0000 |
parents | 8661b858af72 |
children |
line wrap: on
line diff
--- a/test/functional/.svn/text-base/workflows_controller_test.rb.svn-base Thu Mar 03 11:40:10 2011 +0000 +++ b/test/functional/.svn/text-base/workflows_controller_test.rb.svn-base Thu Mar 03 11:42:28 2011 +0000 @@ -65,17 +65,17 @@ # 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 @@ 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 @@ 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