@@ -59,10 +59,14 class Import < ActiveRecord::Base | |||||
59 | wrapper = '"' |
|
59 | wrapper = '"' | |
60 | encoding = lu(user, :general_csv_encoding) |
|
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 | self.settings.merge!( |
|
65 | self.settings.merge!( | |
63 | 'separator' => separator, |
|
66 | 'separator' => separator, | |
64 | 'wrapper' => wrapper, |
|
67 | 'wrapper' => wrapper, | |
65 | 'encoding' => encoding |
|
68 | 'encoding' => encoding, | |
|
69 | 'date_format' => date_format | |||
66 | ) |
|
70 | ) | |
67 | end |
|
71 | end | |
68 |
|
72 |
@@ -92,6 +92,16 class IssueImportTest < ActiveSupport::TestCase | |||||
92 | assert_equal '2015-07-14', issue.custom_field_value(field) |
|
92 | assert_equal '2015-07-14', issue.custom_field_value(field) | |
93 | end |
|
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 | def test_run_should_remove_the_file |
|
105 | def test_run_should_remove_the_file | |
96 | import = generate_import_with_mapping |
|
106 | import = generate_import_with_mapping | |
97 | file_path = import.filepath |
|
107 | file_path = import.filepath |
General Comments 0
You need to be logged in to leave comments.
Login now