summaryrefslogtreecommitdiffstats
path: root/test/functional/repositories_filesystem_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-07 11:28:21 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-07 11:28:21 +0000
commitc5257f6e0dd9124aab79fea2ddcec1df0cab7e7a (patch)
tree344276d96697d349708631a74d6b2d8fc2a92ff2 /test/functional/repositories_filesystem_controller_test.rb
parentc4b58726e6bfe3287be35ee25cd495e423bc21fe (diff)
downloadredmine-c5257f6e0dd9124aab79fea2ddcec1df0cab7e7a.tar.gz
redmine-c5257f6e0dd9124aab79fea2ddcec1df0cab7e7a.zip
scm: add test of showing *real* non ASCII contents in functional filesystem repository test.
TODO: this test fails in Ruby 1.9 and Encoding.default_external is not UTF-8. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5688 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/repositories_filesystem_controller_test.rb')
-rw-r--r--test/functional/repositories_filesystem_controller_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb
index d0b7a3d0b..b1e33b392 100644
--- a/test/functional/repositories_filesystem_controller_test.rb
+++ b/test/functional/repositories_filesystem_controller_test.rb
@@ -29,6 +29,9 @@ class RepositoriesFilesystemControllerTest < ActionController::TestCase
PRJ_ID = 3
def setup
+ @ruby19_non_utf8_pass =
+ (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
+
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@@ -80,6 +83,18 @@ class RepositoriesFilesystemControllerTest < ActionController::TestCase
:content => '2',
:attributes => { :class => 'line-num' },
:sibling => { :tag => 'td', :content => /japanese/ }
+ if @ruby19_non_utf8_pass
+ puts "TODO: show repository file contents test fails in Ruby 1.9 " +
+ "and Encoding.default_external is not UTF-8. " +
+ "Current value is '#{Encoding.default_external.to_s}'"
+ else
+ str_japanese = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"
+ str_japanese.force_encoding('UTF-8') if str_japanese.respond_to?(:force_encoding)
+ assert_tag :tag => 'th',
+ :content => '3',
+ :attributes => { :class => 'line-num' },
+ :sibling => { :tag => 'td', :content => /#{str_japanese}/ }
+ end
end
end