Redmine 4.1.1

This commit is contained in:
Manuel Cillero 2020-11-22 21:20:06 +01:00
parent 33e7b881a5
commit 3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions

View file

@ -1,7 +1,7 @@
# encoding: utf-8
#
# 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
@ -20,6 +20,7 @@
require File.expand_path('../../test_helper', __FILE__)
class SettingTest < ActiveSupport::TestCase
fixtures :users
def setup
User.current = nil
@ -113,23 +114,35 @@ class SettingTest < ActiveSupport::TestCase
end
def test_setting_serialied_as_binary_should_be_loaded_as_utf8_encoded_strings
yaml = <<-YAML
---
- keywords: !binary |
Zml4ZXMsY2xvc2VzLNC40YHQv9GA0LDQstC70LXQvdC+LNCz0L7RgtC+0LLQ
vizRgdC00LXQu9Cw0L3QvixmaXhlZA==
done_ratio: "100"
status_id: "5"
YAML
yaml = <<~YAML
---
- keywords: !binary |
Zml4ZXMsY2xvc2VzLNC40YHQv9GA0LDQstC70LXQvdC+LNCz0L7RgtC+0LLQ
vizRgdC00LXQu9Cw0L3QvixmaXhlZA==
done_ratio: "100"
status_id: "5"
YAML
Setting.commit_update_keywords = {}
assert_equal 1, Setting.where(:name => 'commit_update_keywords').update_all(:value => yaml)
Setting.clear_cache
assert_equal 'UTF-8', Setting.commit_update_keywords.first['keywords'].encoding.name
ensure
Setting.where(:name => 'commit_update_keywords').delete_all
Setting.clear_cache
end
def test_mail_from_format_should_be_validated
with_locale 'en' do
['[Redmine app] <redmine@example.net>', 'redmine'].each do |invalid_mail_from|
errors = Setting.set_all_from_params({:mail_from => invalid_mail_from})
assert_includes errors, [:mail_from, 'is invalid']
end
['Redmine app <redmine@example.net>', 'redmine@example.net', '<redmine@example.net>'].each do |valid_mail_from|
errors = Setting.set_all_from_params({:mail_from => valid_mail_from})
assert_nil errors
end
end
end
end