From c711ead46ca757e996fb17a4f5d7780934eaa559 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 9 Apr 2011 07:52:34 +0000 Subject: [PATCH] scm: more strict log converting test in Ruby 1.9. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5369 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/changeset_test.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb index 9325874d4..95f45379e 100644 --- a/test/unit/changeset_test.rb +++ b/test/unit/changeset_test.rb @@ -232,7 +232,9 @@ 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 = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") + str = "Texte encod\xe9 en ISO-8859-1." + str.force_encoding("ASCII-8BIT") if str.respond_to?(:force_encoding) r = Repository::Bazaar.create!( :project => proj, :url => '/tmp/test/bazaar', :log_encoding => 'ISO-8859-1' ) @@ -243,12 +245,16 @@ class ChangesetTest < ActiveSupport::TestCase :scmid => '12345', :comments => str) assert( c.save ) - assert_equal "Texte encodé en ISO-8859-1.", c.comments + str_utf8 = "Texte encod\xc3\xa9 en ISO-8859-1." + str_utf8.force_encoding("UTF-8") if str_utf8.respond_to?(:force_encoding) + assert_equal str_utf8, c.comments end def test_invalid_utf8_sequences_in_comments_should_be_stripped proj = Project.find(3) - str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") + # str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") + str = "Texte encod\xe9 en ISO-8859-1." + str.force_encoding("ASCII-8BIT") if str.respond_to?(:force_encoding) r = Repository::Bazaar.create!( :project => proj, :url => '/tmp/test/bazaar', :log_encoding => 'UTF-8' ) -- 2.39.5