summaryrefslogtreecommitdiffstats
path: root/test/functional/imports_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-27 08:40:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-27 08:40:39 +0000
commitccb9d4ada9bdf2c24754f0dcf6608d8a3f7e895b (patch)
tree4074ac9da706962ff3a66a047a4ea72048740a1c /test/functional/imports_controller_test.rb
parent86fa4e66c9971dd7f399bba18798792550402706 (diff)
downloadredmine-ccb9d4ada9bdf2c24754f0dcf6608d8a3f7e895b.tar.gz
redmine-ccb9d4ada9bdf2c24754f0dcf6608d8a3f7e895b.zip
Rescue any EncodingError exceptions (#25861).
git-svn-id: http://svn.redmine.org/redmine/trunk@16572 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/imports_controller_test.rb')
-rw-r--r--test/functional/imports_controller_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb
index 3b271b0ce..28ce703f5 100644
--- a/test/functional/imports_controller_test.rb
+++ b/test/functional/imports_controller_test.rb
@@ -102,6 +102,17 @@ class ImportsControllerTest < Redmine::ControllerTest
assert_select 'div#flash_error', /not a valid UTF-8 encoded file/
end
+ def test_post_settings_with_invalid_encoding_should_display_error
+ import = generate_import('invalid-Shift_JIS.csv')
+
+ post :settings, :id => import.to_param,
+ :import_settings => {:separator => ";", :wrapper => '"', :encoding => "Shift_JIS"}
+ assert_response 200
+ import.reload
+ assert_nil import.total_items
+ assert_select 'div#flash_error', /not a valid Shift_JIS encoded file/
+ end
+
def test_get_mapping_should_display_mapping_form
import = generate_import('import_iso8859-1.csv')
import.settings = {'separator' => ";", 'wrapper' => '"', 'encoding' => "ISO-8859-1"}