|
|
@@ -945,9 +945,17 @@ class IssueTest < ActiveSupport::TestCase |
|
|
|
assert_equal [cf2.id.to_s], issue.read_only_attribute_names(user) |
|
|
|
assert_not_include cf2.id.to_s, issue.safe_attribute_names(user) |
|
|
|
|
|
|
|
issue.send :safe_attributes=, {'custom_field_values' => { |
|
|
|
cf1.id.to_s => 'value1', cf2.id.to_s => 'value2' |
|
|
|
}}, user |
|
|
|
issue.send( |
|
|
|
:safe_attributes=, |
|
|
|
{ |
|
|
|
'custom_field_values' => |
|
|
|
{ |
|
|
|
cf1.id.to_s => 'value1', |
|
|
|
cf2.id.to_s => 'value2' |
|
|
|
} |
|
|
|
}, |
|
|
|
user |
|
|
|
) |
|
|
|
assert_equal 'value1', issue.custom_field_value(cf1) |
|
|
|
assert_nil issue.custom_field_value(cf2) |
|
|
|
|
|
|
@@ -2960,11 +2968,13 @@ class IssueTest < ActiveSupport::TestCase |
|
|
|
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.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 |