20160606_auto_select_fields_test.patch

Haihan Ji, 2016-06-06 12:28

Download (1.37 KB)

View differences:

test/fixtures/files/import_auto_mapping.csv
1
Column 0,Column 1,Column 2,Subject,Column 4,Database,Column 6
2
0,1,2,3,4,5,6
test/functional/imports_controller_test.rb
120 120
    end
121 121
  end
122 122

  
123
  def test_get_mapping_should_auto_select_by_column_name
124
    import = generate_import('import_auto_mapping.csv')
125
    import.settings = {'separator' => ',', 'wrapper'=> '""', 'encoding' => 'ISO-8859-1'}
126
    import.save!
127

  
128
    get :mapping, :id => import.to_param
129
    assert_response :success
130

  
131
    assert_select 'select[name=?]', 'import_settings[mapping][subject]' do
132
      assert_select 'option[value="3"][selected="selected"]', :text => 'Subject'
133
    end
134
    assert_select 'select[name=?]', 'import_settings[mapping][cf_1]' do
135
      assert_select 'option[value="5"][selected="selected"]', :text => 'Database'
136
    end
137
  end
138

  
123 139
  def test_post_mapping_should_update_mapping
124 140
    import = generate_import('import_iso8859-1.csv')