Project

General

Profile

Patch #25861 » 0001-adds-failing-test-case-for-import-with-wrong-encodin.patch

test case - Jens Krämer, 2017-05-16 11:06

View differences:

test/fixtures/files/invalid-Shift_JIS.csv
1
?@
test/functional/imports_controller_test.rb
102 102
    assert_select 'div#flash_error', /not a valid UTF-8 encoded file/
103 103
  end
104 104

  
105
  def test_post_settings_with_invalid_encoding_should_display_error
106
    import = generate_import('invalid-Shift_JIS.csv')
107

  
108
    post :settings, :id => import.to_param,
109
      :import_settings => {:separator => ";", :wrapper => '"', :encoding => "Shift_JIS"}
110
    assert_response 200
111
    import.reload
112
    assert_nil import.total_items
113
    assert_select 'div#flash_error', /not a valid Shift_JIS encoded file/
114
  end
115

  
105 116
  def test_get_mapping_should_display_mapping_form
106 117
    import = generate_import('import_iso8859-1.csv')
107 118
    import.settings = {'separator' => ";", 'wrapper' => '"', 'encoding' => "ISO-8859-1"}
(1-1/2)