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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user