Make sure that attachments are created in the same order they were selected (#12310).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10793 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-11-07 18:45:56 +00:00
parent 00927f58af
commit a17f4c8375
2 changed files with 27 additions and 1 deletions
+14
View File
@@ -1888,4 +1888,18 @@ class IssueTest < ActiveSupport::TestCase
assert_include 'priority-8', classes
assert_include 'priority-highest', classes
end
def test_save_attachments_with_hash_should_save_attachments_in_keys_order
set_tmp_attachments_directory
issue = Issue.generate!
issue.save_attachments({
'p0' => {'file' => mock_file_with_options(:original_filename => 'upload')},
'3' => {'file' => mock_file_with_options(:original_filename => 'bar')},
'1' => {'file' => mock_file_with_options(:original_filename => 'foo')}
})
issue.attach_saved_attachments
assert_equal 3, issue.reload.attachments.count
assert_equal %w(upload foo bar), issue.attachments.map(&:filename)
end
end