Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -18,14 +20,28 @@
|
|||
require File.expand_path('../../../../../test_helper', __FILE__)
|
||||
|
||||
class CsvTest < ActiveSupport::TestCase
|
||||
|
||||
BOM = "\xEF\xBB\xBF".force_encoding('UTF-8')
|
||||
include Redmine::I18n
|
||||
|
||||
def test_should_include_bom_when_utf8_encoded
|
||||
with_locale 'sk' do
|
||||
string = Redmine::Export::CSV.generate {|csv| csv << %w(Foo Bar)}
|
||||
assert_equal 'UTF-8', string.encoding.name
|
||||
assert string.starts_with?(BOM)
|
||||
assert string.starts_with?("\xEF\xBB\xBF")
|
||||
end
|
||||
end
|
||||
|
||||
def test_generate_should_return_strings_with_given_encoding
|
||||
with_locale 'en' do
|
||||
string = Redmine::Export::CSV.generate({encoding: 'ISO-8859-3'}) {|csv| csv << %w(Foo Bar)}
|
||||
assert_equal 'ISO-8859-3', string.encoding.name
|
||||
assert_not_equal l(:general_csv_encoding), string.encoding.name
|
||||
end
|
||||
end
|
||||
|
||||
def test_generate_should_return_strings_with_general_csv_encoding_if_invalid_encoding_is_given
|
||||
with_locale 'en' do
|
||||
string = Redmine::Export::CSV.generate({encoding: 'invalid-encoding-name'}) {|csv| csv << %w(Foo Bar)}
|
||||
assert_equal l(:general_csv_encoding), string.encoding.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue