Defect #34326 » fixed-34326.patch
| app/controllers/imports_controller.rb | ||
|---|---|---|
|
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|
|
||
| test/fixtures/files/import_issues_auto_mapping.csv | ||
|---|---|---|
|
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
|
||
| test/functional/imports_controller_test.rb | ||
|---|---|---|
|
# - '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
|
||
| ... | ... | |
|
# 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
|
||