diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-13 20:04:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-13 20:04:14 +0000 |
commit | 19492226f7b2451524a1013a0ab979e6fdd30a7c (patch) | |
tree | 618d792f885d2839cd76c994f43e138c2af6dd1f /test | |
parent | 793cb1676450a5b3e723a452893c10be1cb0f1bd (diff) | |
download | redmine-19492226f7b2451524a1013a0ab979e6fdd30a7c.tar.gz redmine-19492226f7b2451524a1013a0ab979e6fdd30a7c.zip |
Ability to delete multiple attachments while updating an issue (#13072).
git-svn-id: http://svn.redmine.org/redmine/trunk@15650 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/issues_controller_test.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index d571d4bda..d878b9608 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -3761,6 +3761,44 @@ class IssuesControllerTest < ActionController::TestCase end end + def test_put_update_with_attachment_deletion_should_create_a_single_journal + set_tmp_attachments_directory + @request.session[:user_id] = 2 + + journal = new_record(Journal) do + assert_difference 'Attachment.count', -2 do + put :update, + :id => 3, + :issue => { + :notes => 'Removing attachments', + :deleted_attachment_ids => ['1', '5'] + } + end + end + assert_equal 'Removing attachments', journal.notes + assert_equal 2, journal.details.count + end + + def test_put_update_with_attachment_deletion_and_failure_should_preserve_selected_attachments + set_tmp_attachments_directory + @request.session[:user_id] = 2 + + assert_no_difference 'Journal.count' do + assert_no_difference 'Attachment.count' do + put :update, + :id => 3, + :issue => { + :subject => '', + :notes => 'Removing attachments', + :deleted_attachment_ids => ['1', '5'] + } + end + end + assert_select 'input[name=?][value="1"][checked=checked]', 'issue[deleted_attachment_ids][]' + assert_select 'input[name=?][value="5"][checked=checked]', 'issue[deleted_attachment_ids][]' + assert_select 'input[name=?][value="6"]:not([checked])', 'issue[deleted_attachment_ids][]' + end + def test_put_update_with_no_change issue = Issue.find(1) issue.journals.clear |