summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/changeset_test.rb21
-rw-r--r--test/unit/helpers/application_helper_test.rb4
-rw-r--r--test/unit/repository_bazaar_test.rb7
-rw-r--r--test/unit/repository_cvs_test.rb8
-rw-r--r--test/unit/repository_darcs_test.rb4
-rw-r--r--test/unit/repository_test.rb11
6 files changed, 34 insertions, 21 deletions
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 3884096b6..767192db0 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -220,12 +220,13 @@ class ChangesetTest < ActiveSupport::TestCase
changeset = Changeset.find_by_revision('10')
assert_nil changeset.next
end
-
+
def test_comments_should_be_converted_to_utf8
- with_settings :commit_logs_encoding => 'ISO-8859-1' do
proj = Project.find(3)
str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
- r = Repository::Bazaar.create!(:project => proj, :url => '/tmp/test/bazaar')
+ r = Repository::Bazaar.create!(
+ :project => proj, :url => '/tmp/test/bazaar',
+ :log_encoding => 'ISO-8859-1' )
assert r
c = Changeset.new(:repository => r,
:committed_on => Time.now,
@@ -234,14 +235,14 @@ class ChangesetTest < ActiveSupport::TestCase
:comments => str)
assert( c.save )
assert_equal "Texte encodé en ISO-8859-1.", c.comments
- end
end
def test_invalid_utf8_sequences_in_comments_should_be_stripped
- with_settings :commit_logs_encoding => 'UTF-8' do
proj = Project.find(3)
str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
- r = Repository::Bazaar.create!(:project => proj, :url => '/tmp/test/bazaar')
+ r = Repository::Bazaar.create!(
+ :project => proj, :url => '/tmp/test/bazaar',
+ :log_encoding => 'UTF-8' )
assert r
c = Changeset.new(:repository => r,
:committed_on => Time.now,
@@ -254,11 +255,9 @@ class ChangesetTest < ActiveSupport::TestCase
else
assert_equal "Texte encod en ISO-8859-1.", c.comments
end
- end
end
def test_comments_should_be_converted_all_latin1_to_utf8
- with_settings :commit_logs_encoding => 'ISO-8859-1' do
s1 = "\xC2\x80"
s2 = "\xc3\x82\xc2\x80"
if s1.respond_to?(:force_encoding)
@@ -271,7 +270,10 @@ class ChangesetTest < ActiveSupport::TestCase
assert_equal s3.encode('UTF-8'), s4
end
proj = Project.find(3)
- r = Repository::Bazaar.create!(:project => proj, :url => '/tmp/test/bazaar')
+ r = Repository::Bazaar.create!(
+ :project => proj, :url => '/tmp/test/bazaar',
+ :log_encoding => 'ISO-8859-1' )
+ assert r
assert r
c = Changeset.new(:repository => r,
:committed_on => Time.now,
@@ -280,7 +282,6 @@ class ChangesetTest < ActiveSupport::TestCase
:comments => s1)
assert( c.save )
assert_equal s2, c.comments
- end
end
def test_identifier
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 69eaf7456..aa2c62776 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -292,7 +292,9 @@ RAW
'commit:20080308225258-98289-abcd456efg.gz' => changeset_link,
}
@project = Project.find(3)
- r = Repository::Darcs.create!(:project => @project, :url => '/tmp/test/darcs')
+ r = Repository::Darcs.create!(
+ :project => @project, :url => '/tmp/test/darcs',
+ :log_encoding => 'UTF-8')
assert r
c = Changeset.new(:repository => r,
:committed_on => Time.now,
diff --git a/test/unit/repository_bazaar_test.rb b/test/unit/repository_bazaar_test.rb
index 38f2af498..b2515fe30 100644
--- a/test/unit/repository_bazaar_test.rb
+++ b/test/unit/repository_bazaar_test.rb
@@ -19,14 +19,17 @@ require File.expand_path('../../test_helper', __FILE__)
class RepositoryBazaarTest < ActiveSupport::TestCase
fixtures :projects
-
+
# No '..' in the repository path
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository'
REPOSITORY_PATH.gsub!(/\/+/, '/')
def setup
@project = Project.find(3)
- assert @repository = Repository::Bazaar.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}")
+ @repository = Repository::Bazaar.create(
+ :project => @project, :url => "file:///#{REPOSITORY_PATH}",
+ :log_encoding => 'UTF-8')
+ assert @repository
end
if File.directory?(REPOSITORY_PATH)
diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb
index a5da09f55..0fd81615b 100644
--- a/test/unit/repository_cvs_test.rb
+++ b/test/unit/repository_cvs_test.rb
@@ -28,9 +28,11 @@ class RepositoryCvsTest < ActiveSupport::TestCase
def setup
@project = Project.find(3)
- assert @repository = Repository::Cvs.create(:project => @project,
- :root_url => REPOSITORY_PATH,
- :url => MODULE_NAME)
+ @repository = Repository::Cvs.create(:project => @project,
+ :root_url => REPOSITORY_PATH,
+ :url => MODULE_NAME,
+ :log_encoding => 'UTF-8')
+ assert @repository
end
if File.directory?(REPOSITORY_PATH)
diff --git a/test/unit/repository_darcs_test.rb b/test/unit/repository_darcs_test.rb
index ef833e93d..2e16973c5 100644
--- a/test/unit/repository_darcs_test.rb
+++ b/test/unit/repository_darcs_test.rb
@@ -25,7 +25,9 @@ class RepositoryDarcsTest < ActiveSupport::TestCase
def setup
@project = Project.find(3)
- @repository = Repository::Darcs.create(:project => @project, :url => REPOSITORY_PATH)
+ @repository = Repository::Darcs.create(
+ :project => @project, :url => REPOSITORY_PATH,
+ :log_encoding => 'UTF-8')
assert @repository
end
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index 8c4146ff0..4e6099e3e 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -125,16 +125,19 @@ class RepositoryTest < ActiveSupport::TestCase
assert_not_equal( comment, changeset.comments )
assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments )
end
-
+
def test_for_urls_strip
- repository = Repository::Cvs.create(:project => Project.find(4), :url => ' :pserver:login:password@host:/path/to/the/repository',
- :root_url => 'foo ')
+ repository = Repository::Cvs.create(
+ :project => Project.find(4),
+ :url => ' :pserver:login:password@host:/path/to/the/repository',
+ :root_url => 'foo ',
+ :log_encoding => 'UTF-8')
assert repository.save
repository.reload
assert_equal ':pserver:login:password@host:/path/to/the/repository', repository.url
assert_equal 'foo', repository.root_url
end
-
+
def test_manual_user_mapping
assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do
c = Changeset.create!(:repository => @repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')