6234 |
6234 |
def test_destroy_issues_with_time_entries_should_show_the_reassign_form
|
6235 |
6235 |
@request.session[:user_id] = 2
|
6236 |
6236 |
|
|
6237 |
with_settings :timelog_required_fields => [] do
|
|
6238 |
assert_no_difference 'Issue.count' do
|
|
6239 |
delete :destroy, :params => {
|
|
6240 |
:ids => [1, 3]
|
|
6241 |
}
|
|
6242 |
end
|
|
6243 |
end
|
|
6244 |
assert_response :success
|
|
6245 |
|
|
6246 |
assert_select 'form' do
|
|
6247 |
assert_select 'input[name=_method][value=delete]'
|
|
6248 |
assert_select 'input[name=todo][value=destroy]'
|
|
6249 |
assert_select 'input[name=todo][value=nullify]'
|
|
6250 |
assert_select 'input[name=todo][value=reassign]'
|
|
6251 |
end
|
|
6252 |
end
|
|
6253 |
|
|
6254 |
def test_destroy_issues_with_time_entries_should_not_show_the_nullify_option_when_issue_is_required_for_time_entries
|
|
6255 |
with_settings :timelog_required_fields => ['issue_id'] do
|
|
6256 |
@request.session[:user_id] = 2
|
|
6257 |
|
6237 |
6258 |
assert_no_difference 'Issue.count' do
|
6238 |
6259 |
delete :destroy, :params => {
|
6239 |
6260 |
:ids => [1, 3]
|
... | ... | |
6243 |
6264 |
|
6244 |
6265 |
assert_select 'form' do
|
6245 |
6266 |
assert_select 'input[name=_method][value=delete]'
|
|
6267 |
assert_select 'input[name=todo][value=destroy]'
|
|
6268 |
assert_select 'input[name=todo][value=nullify]', 0
|
|
6269 |
assert_select 'input[name=todo][value=reassign]'
|
|
6270 |
end
|
6246 |
6271 |
end
|
6247 |
6272 |
end
|
6248 |
6273 |
|
... | ... | |
6281 |
6306 |
def test_destroy_issues_and_assign_time_entries_to_project
|
6282 |
6307 |
@request.session[:user_id] = 2
|
6283 |
6308 |
|
|
6309 |
with_settings :timelog_required_fields => [] do
|
6284 |
6310 |
assert_difference 'Issue.count', -2 do
|
6285 |
6311 |
assert_no_difference 'TimeEntry.count' do
|
6286 |
6312 |
delete :destroy, :params => {
|
... | ... | |
6289 |
6315 |
}
|
6290 |
6316 |
end
|
6291 |
6317 |
end
|
|
6318 |
end
|
6292 |
6319 |
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
6293 |
6320 |
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
6294 |
6321 |
assert_nil TimeEntry.find(1).issue_id
|
... | ... | |
6367 |
6394 |
assert_select '#flash_error', :text => I18n.t(:error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted)
|
6368 |
6395 |
end
|
6369 |
6396 |
|
|
6397 |
def test_destroy_issues_and_nullify_time_entries_should_fail_when_issue_is_required_for_time_entries
|
|
6398 |
@request.session[:user_id] = 2
|
|
6399 |
|
|
6400 |
with_settings :timelog_required_fields => ['issue_id'] do
|
|
6401 |
assert_no_difference 'Issue.count' do
|
|
6402 |
assert_no_difference 'TimeEntry.count' do
|
|
6403 |
delete :destroy, :params => {
|
|
6404 |
:ids => [1, 3],
|
|
6405 |
:todo => 'nullify'
|
|
6406 |
}
|
|
6407 |
end
|
|
6408 |
end
|
|
6409 |
end
|
|
6410 |
assert_response :success
|
|
6411 |
assert_select '#flash_error', :text => 'Issue cannot be blank'
|
|
6412 |
end
|
|
6413 |
|
6370 |
6414 |
def test_destroy_issues_from_different_projects
|
6371 |
6415 |
@request.session[:user_id] = 2
|
6372 |
6416 |
|