Mercurial > hg > soundsoftware-site
comparison test/functional/workflows_controller_test.rb @ 245:051f544170fe
* Update to SVN trunk revision 4993
author | Chris Cannam |
---|---|
date | Thu, 03 Mar 2011 11:42:28 +0000 |
parents | 8661b858af72 |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
244:8972b600f4fb | 245:051f544170fe |
---|---|
63 assert_not_nil assigns(:statuses) | 63 assert_not_nil assigns(:statuses) |
64 assert_equal [2, 3, 5], assigns(:statuses).collect(&:id) | 64 assert_equal [2, 3, 5], assigns(:statuses).collect(&:id) |
65 | 65 |
66 # allowed transitions | 66 # allowed transitions |
67 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', | 67 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', |
68 :name => 'issue_status[3][]', | 68 :name => 'issue_status[3][5][]', |
69 :value => '5', | 69 :value => 'always', |
70 :checked => 'checked' } | 70 :checked => 'checked' } |
71 # not allowed | 71 # not allowed |
72 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', | 72 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', |
73 :name => 'issue_status[3][]', | 73 :name => 'issue_status[3][2][]', |
74 :value => '2', | 74 :value => 'always', |
75 :checked => nil } | 75 :checked => nil } |
76 # unused | 76 # unused |
77 assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', | 77 assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', |
78 :name => 'issue_status[4][]' } | 78 :name => 'issue_status[1][1][]' } |
79 end | 79 end |
80 | 80 |
81 def test_get_edit_with_role_and_tracker_and_all_statuses | 81 def test_get_edit_with_role_and_tracker_and_all_statuses |
82 Workflow.delete_all | 82 Workflow.delete_all |
83 | 83 |
87 | 87 |
88 assert_not_nil assigns(:statuses) | 88 assert_not_nil assigns(:statuses) |
89 assert_equal IssueStatus.count, assigns(:statuses).size | 89 assert_equal IssueStatus.count, assigns(:statuses).size |
90 | 90 |
91 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', | 91 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', |
92 :name => 'issue_status[1][]', | 92 :name => 'issue_status[1][1][]', |
93 :value => '1', | 93 :value => 'always', |
94 :checked => nil } | 94 :checked => nil } |
95 end | 95 end |
96 | 96 |
97 def test_post_edit | 97 def test_post_edit |
98 post :edit, :role_id => 2, :tracker_id => 1, :issue_status => {'4' => ['5'], '3' => ['1', '2']} | 98 post :edit, :role_id => 2, :tracker_id => 1, |
99 :issue_status => { | |
100 '4' => {'5' => ['always']}, | |
101 '3' => {'1' => ['always'], '2' => ['always']} | |
102 } | |
99 assert_redirected_to '/workflows/edit?role_id=2&tracker_id=1' | 103 assert_redirected_to '/workflows/edit?role_id=2&tracker_id=1' |
100 | 104 |
101 assert_equal 3, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) | 105 assert_equal 3, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) |
102 assert_not_nil Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2}) | 106 assert_not_nil Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2}) |
103 assert_nil Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4}) | 107 assert_nil Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4}) |
108 end | |
109 | |
110 def test_post_edit_with_additional_transitions | |
111 post :edit, :role_id => 2, :tracker_id => 1, | |
112 :issue_status => { | |
113 '4' => {'5' => ['always']}, | |
114 '3' => {'1' => ['author'], '2' => ['assignee'], '4' => ['author', 'assignee']} | |
115 } | |
116 assert_redirected_to '/workflows/edit?role_id=2&tracker_id=1' | |
117 | |
118 assert_equal 4, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) | |
119 | |
120 w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 4, :new_status_id => 5}) | |
121 assert ! w.author | |
122 assert ! w.assignee | |
123 w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 1}) | |
124 assert w.author | |
125 assert ! w.assignee | |
126 w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2}) | |
127 assert ! w.author | |
128 assert w.assignee | |
129 w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 4}) | |
130 assert w.author | |
131 assert w.assignee | |
104 end | 132 end |
105 | 133 |
106 def test_clear_workflow | 134 def test_clear_workflow |
107 assert Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) > 0 | 135 assert Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) > 0 |
108 | 136 |