summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-07 10:31:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-07 10:31:20 +0000
commit40c9c3e922e15ab7d88b5d06c60e51ed1ba40a7f (patch)
tree0fe287037410c16fa9e4bc1743b4c00482c99bd4 /test/unit/issue_test.rb
parent3c45e433d5551a7bff114db8926f9a449aacc85d (diff)
downloadredmine-40c9c3e922e15ab7d88b5d06c60e51ed1ba40a7f.tar.gz
redmine-40c9c3e922e15ab7d88b5d06c60e51ed1ba40a7f.zip
Notify the user of missing attachments (#22401).
under certain (rare) circumstances it may happen that, when an issue or other container is saved, added attachments have already been removed (i.e. by the attachments:prune rake task). This patch adds a validation error to the container in this case. Patch by Jens Kraemer. git-svn-id: http://svn.redmine.org/redmine/trunk@15378 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index a07b18ff5..03dd57229 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -2527,6 +2527,17 @@ class IssueTest < ActiveSupport::TestCase
assert_equal %w(upload foo bar), issue.attachments.map(&:filename)
end
+ def test_save_attachments_with_array_should_warn_about_missing_tokens
+ set_tmp_attachments_directory
+ issue = Issue.generate!
+ issue.save_attachments([
+ {'token' => 'missing'}
+ ])
+ assert !issue.save
+ assert issue.errors[:base].present?
+ assert_equal 0, issue.reload.attachments.count
+ end
+
def test_closed_on_should_be_nil_when_creating_an_open_issue
issue = Issue.generate!(:status_id => 1).reload
assert !issue.closed?