diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 9431ca098..a5248dc1e 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -173,7 +173,7 @@ class ImportsController < ApplicationController return if @import.settings['encoding'].blank? mappings = @import.settings['mapping'] ||= {} - headers = @import.headers.map(&:downcase) + headers = @import.headers.map{|header| header.to_s.downcase} # Core fields import_type::AUTO_MAPPABLE_FIELDS.each do |field_nm, label_nm| diff --git a/test/fixtures/files/import_issues_auto_mapping.csv b/test/fixtures/files/import_issues_auto_mapping.csv index 49785f7a4..61f3e8357 100644 --- a/test/fixtures/files/import_issues_auto_mapping.csv +++ b/test/fixtures/files/import_issues_auto_mapping.csv @@ -1,2 +1,2 @@ -priority;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6 -High;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2 +priority;;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6 +High;;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2 diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb index 8a69c7dee..fc833ec4a 100644 --- a/test/functional/imports_controller_test.rb +++ b/test/functional/imports_controller_test.rb @@ -190,19 +190,19 @@ class ImportsControllerTest < Redmine::ControllerTest # - 'Subject' exists in the import file # - mapping is case insensitive assert_select 'select[name=?]', 'import_settings[mapping][subject]' do - assert_select 'option[value="1"][selected="selected"]', :text => 'Subject' + assert_select 'option[value="2"][selected="selected"]', :text => 'Subject' end # 'estimated_hours' should be auto selected because # - 'estimated_hours' exists in the import file assert_select 'select[name=?]', 'import_settings[mapping][estimated_hours]' do - assert_select 'option[value="10"][selected="selected"]', :text => 'estimated_hours' + assert_select 'option[value="11"][selected="selected"]', :text => 'estimated_hours' end # 'fixed_version' should be auto selected because # - the translation 'Target version' exists in the import file assert_select 'select[name=?]', 'import_settings[mapping][fixed_version]' do - assert_select 'option[value="7"][selected="selected"]', :text => 'target version' + assert_select 'option[value="8"][selected="selected"]', :text => 'target version' end # 'assigned_to' should not be auto selected because @@ -214,14 +214,14 @@ class ImportsControllerTest < Redmine::ControllerTest # Custom field 'Float field' should be auto selected because # - the internal field name ('cf_6') exists in the import file assert_select 'select[name=?]', 'import_settings[mapping][cf_6]' do - assert_select 'option[value="14"][selected="selected"]', :text => 'cf_6' + assert_select 'option[value="15"][selected="selected"]', :text => 'cf_6' end # Custom field 'Database' should be auto selected because # - field name 'database' exists in the import file # - mapping is case insensitive assert_select 'select[name=?]', 'import_settings[mapping][cf_1]' do - assert_select 'option[value="13"][selected="selected"]', :text => 'database' + assert_select 'option[value="14"][selected="selected"]', :text => 'database' end end