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
@ -50,7 +50,7 @@ class ChangesetTest < ActiveSupport::TestCase
fixed = Issue.find(1)
assert fixed.closed?
assert_equal 90, fixed.done_ratio
assert_equal 1, ActionMailer::Base.deliveries.size
assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_ref_keywords
@ -210,7 +210,6 @@ class ChangesetTest < ActiveSupport::TestCase
{'keywords' => 'fixes, closes', 'status_id' => '5'},
{'keywords' => 'resolves', 'status_id' => '3'}
] do
issue1 = Issue.generate!
issue2 = Issue.generate!
Changeset.generate!(:comments => "Closes ##{issue1.id}\nResolves ##{issue2.id}")
@ -224,7 +223,6 @@ class ChangesetTest < ActiveSupport::TestCase
{'keywords' => 'fixes', 'status_id' => '5', 'if_tracker_id' => '2'},
{'keywords' => 'fixes', 'status_id' => '3', 'if_tracker_id' => ''}
] do
issue1 = Issue.generate!(:tracker_id => 2)
issue2 = Issue.generate!
Changeset.generate!(:comments => "Fixes ##{issue1.id}, ##{issue2.id}")
@ -238,7 +236,6 @@ class ChangesetTest < ActiveSupport::TestCase
{'keywords' => 'Fixes, Closes', 'status_id' => '5', 'done_ratio' => '100', 'if_tracker_id' => '2'},
{'keywords' => 'Testing', 'status_id' => '3', 'done_ratio' => '90', 'if_tracker_id' => '2'}
] do
issue1 = Issue.generate!(:tracker_id => 2)
issue2 = Issue.generate!(:tracker_id => 2)
Changeset.generate!(:comments => "Testing ##{issue1.id}, Fixes ##{issue2.id}")
@ -256,7 +253,6 @@ class ChangesetTest < ActiveSupport::TestCase
{'keywords' => 'fixes', 'status_id' => '5', 'if_tracker_id' => '2'},
{'keywords' => 'fixes', 'status_id' => '3', 'if_tracker_id' => '3'}
] do
issue1 = Issue.generate!(:tracker_id => 2)
issue2 = Issue.generate!
Changeset.generate!(:comments => "Fixes ##{issue1.id}, ##{issue2.id}")
@ -448,8 +444,7 @@ class ChangesetTest < ActiveSupport::TestCase
def test_comments_should_be_converted_to_utf8
proj = Project.find(3)
# str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
str = "Texte encod\xe9 en ISO-8859-1.".force_encoding("ASCII-8BIT")
str = "Texte encod\xe9 en ISO-8859-1.".b
r = Repository::Bazaar.create!(
:project => proj,
:url => '/tmp/test/bazaar',
@ -461,15 +456,12 @@ class ChangesetTest < ActiveSupport::TestCase
:scmid => '12345',
:comments => str)
assert( c.save )
str_utf8 = "Texte encod\xc3\xa9 en ISO-8859-1.".force_encoding("UTF-8")
assert_equal str_utf8, c.comments
assert_equal 'Texte encodé en ISO-8859-1.', c.comments
end
def test_invalid_utf8_sequences_in_comments_should_be_replaced_latin1
proj = Project.find(3)
# str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
str1 = "Texte encod\xe9 en ISO-8859-1.".force_encoding("UTF-8")
str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".force_encoding("ASCII-8BIT")
str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".b
r = Repository::Bazaar.create!(
:project => proj,
:url => '/tmp/test/bazaar',
@ -479,7 +471,7 @@ class ChangesetTest < ActiveSupport::TestCase
:committed_on => Time.now,
:revision => '123',
:scmid => '12345',
:comments => str1,
:comments => "Texte encod\xE9 en ISO-8859-1.",
:committer => str2)
assert( c.save )
assert_equal "Texte encod? en ISO-8859-1.", c.comments
@ -488,7 +480,7 @@ class ChangesetTest < ActiveSupport::TestCase
def test_invalid_utf8_sequences_in_comments_should_be_replaced_ja_jis
proj = Project.find(3)
str = "test\xb5\xfetest\xb5\xfe".force_encoding('ASCII-8BIT')
str = "test\xb5\xfetest\xb5\xfe".b
r = Repository::Bazaar.create!(
:project => proj,
:url => '/tmp/test/bazaar',
@ -504,12 +496,12 @@ class ChangesetTest < ActiveSupport::TestCase
end
def test_comments_should_be_converted_all_latin1_to_utf8
s1 = "\xC2\x80"
s2 = "\xc3\x82\xc2\x80"
s1 = +"\xC2\x80"
s2 = +"\xc3\x82\xc2\x80"
s4 = s2.dup
s3 = s1.dup
s1.force_encoding('ASCII-8BIT')
s2.force_encoding('ASCII-8BIT')
s1 = s1.b
s2 = s2.b
s3.force_encoding('ISO-8859-1')
s4.force_encoding('UTF-8')
assert_equal s3.encode('UTF-8'), s4
@ -530,8 +522,7 @@ class ChangesetTest < ActiveSupport::TestCase
def test_invalid_utf8_sequences_in_paths_should_be_replaced
proj = Project.find(3)
str1 = "Texte encod\xe9 en ISO-8859-1".force_encoding("UTF-8")
str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".force_encoding("ASCII-8BIT")
str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".b
r = Repository::Bazaar.create!(
:project => proj,
:url => '/tmp/test/bazaar',
@ -547,7 +538,7 @@ class ChangesetTest < ActiveSupport::TestCase
ch = Change.new(
:changeset => cs,
:action => "A",
:path => str1,
:path => "Texte encod\xE9 en ISO-8859-1",
:from_path => str2,
:from_revision => "345")
assert(ch.save)