]> source.dussan.org Git - redmine.git/commitdiff
Adds a test for importing list custom fields with multiple values (#26148).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 19 Jul 2017 17:07:13 +0000 (17:07 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 19 Jul 2017 17:07:13 +0000 (17:07 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16837 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/fixtures/files/import_issues.csv
test/unit/issue_import_test.rb

index fa9d226650757487631abd9cf3b74ece5d6ff1cf..fa9adcd7ec1a51972f839d4b4f7b0d26d1262cf5 100644 (file)
@@ -1,4 +1,4 @@
-priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user;estimated_hours;tracker;status
-High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1;bug;new
-Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2;feature request;new
-Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3;bug;assigned
+priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user;estimated_hours;tracker;status;multicustom
+High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle"
+Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2;feature request;new;MySQL
+Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3;bug;assigned;
index 41958cb6a185f846f2be5059e5b991f3f9f2151c..bcbf942ae19844de64241e3ecd8f3adc2b3a4315 100644 (file)
@@ -161,6 +161,21 @@ class IssueImportTest < ActiveSupport::TestCase
     assert_equal '', issues.third.custom_field_value(1)
   end
 
+  def test_multiple_list_custom_field_should_be_set
+    field = CustomField.find(1)
+    field.tracker_ids = Tracker.all.ids
+    field.multiple = true
+    field.save!
+    import = generate_import_with_mapping
+    import.mapping.merge!("cf_1" => '15')
+    import.save!
+
+    issues = new_records(Issue, 3) { import.run }
+    assert_equal ['Oracle', 'PostgreSQL'], issues[0].custom_field_value(1).sort
+    assert_equal ['MySQL'], issues[1].custom_field_value(1)
+    assert_equal [''], issues.third.custom_field_value(1)
+  end
+
   def test_is_private_should_be_set_based_on_user_locale
     import = generate_import_with_mapping
     import.mapping.merge!('is_private' => '6')