diff options
-rw-r--r-- | app/models/issue_import.rb | 2 | ||||
-rw-r--r-- | test/fixtures/files/import_issues.csv | 8 | ||||
-rw-r--r-- | test/unit/issue_import_test.rb | 9 |
3 files changed, 14 insertions, 5 deletions
diff --git a/app/models/issue_import.rb b/app/models/issue_import.rb index bd4351768..5a8748cd0 100644 --- a/app/models/issue_import.rb +++ b/app/models/issue_import.rb @@ -90,7 +90,7 @@ class IssueImport < Import end end if assignee_name = row_value(row, 'assigned_to') - if assignee = issue.assignable_users.detect {|u| u.name.downcase == assignee_name.downcase} + if assignee = Principal.detect_by_keyword(issue.assignable_users, assignee_name) attributes['assigned_to_id'] = assignee.id end end diff --git a/test/fixtures/files/import_issues.csv b/test/fixtures/files/import_issues.csv index e4cb5aa2c..b648a42ba 100644 --- a/test/fixtures/files/import_issues.csv +++ b/test/fixtures/files/import_issues.csv @@ -1,4 +1,4 @@ -priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category -High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category -Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category -Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing +priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user +High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper +Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category; +Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing; diff --git a/test/unit/issue_import_test.rb b/test/unit/issue_import_test.rb index 7d0a7b9e1..ec0b57b38 100644 --- a/test/unit/issue_import_test.rb +++ b/test/unit/issue_import_test.rb @@ -69,6 +69,15 @@ class IssueImportTest < ActiveSupport::TestCase assert_equal 2, issues[2].parent_id end + def test_assignee_should_be_set + import = generate_import_with_mapping + import.mapping.merge!('assigned_to' => '11') + import.save! + + issues = new_records(Issue, 3) { import.run } + assert_equal [User.find(3), nil, nil], issues.map(&:assigned_to) + end + def test_is_private_should_be_set_based_on_user_locale import = generate_import_with_mapping import.mapping.merge!('is_private' => '6') |