@@ -59,10 +59,14 class Import < ActiveRecord::Base | |||
|
59 | 59 | wrapper = '"' |
|
60 | 60 | encoding = lu(user, :general_csv_encoding) |
|
61 | 61 | |
|
62 | date_format = lu(user, "date.formats.default", :default => "foo") | |
|
63 | date_format = DATE_FORMATS.first unless DATE_FORMATS.include?(date_format) | |
|
64 | ||
|
62 | 65 | self.settings.merge!( |
|
63 | 66 | 'separator' => separator, |
|
64 | 67 | 'wrapper' => wrapper, |
|
65 | 'encoding' => encoding | |
|
68 | 'encoding' => encoding, | |
|
69 | 'date_format' => date_format | |
|
66 | 70 | ) |
|
67 | 71 | end |
|
68 | 72 |
@@ -92,6 +92,16 class IssueImportTest < ActiveSupport::TestCase | |||
|
92 | 92 | assert_equal '2015-07-14', issue.custom_field_value(field) |
|
93 | 93 | end |
|
94 | 94 | |
|
95 | def test_date_format_should_default_to_user_language | |
|
96 | user = User.generate!(:language => 'fr') | |
|
97 | import = Import.new | |
|
98 | import.user = user | |
|
99 | assert_nil import.settings['date_format'] | |
|
100 | ||
|
101 | import.set_default_settings | |
|
102 | assert_equal '%d/%m/%Y', import.settings['date_format'] | |
|
103 | end | |
|
104 | ||
|
95 | 105 | def test_run_should_remove_the_file |
|
96 | 106 | import = generate_import_with_mapping |
|
97 | 107 | file_path = import.filepath |
General Comments 0
You need to be logged in to leave comments.
Login now