]> source.dussan.org Git - redmine.git/commitdiff
scm: filesystem: add test to override human_attribute_name of "Root directory"
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 24 Feb 2012 13:04:06 +0000 (13:04 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 24 Feb 2012 13:04:06 +0000 (13:04 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8967 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/repository_filesystem_test.rb

index 3579d76085acea619d295bd56d469c2fa909333d..add467d676531e3b8de72f43893279ab5a42b982 100644 (file)
@@ -20,6 +20,8 @@ require File.expand_path('../../test_helper', __FILE__)
 class RepositoryFilesystemTest < ActiveSupport::TestCase
   fixtures :projects
 
+  include Redmine::I18n
+
   REPOSITORY_PATH = Rails.root.join('tmp/test/filesystem_repository').to_s
 
   def setup
@@ -32,6 +34,31 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase
     assert @repository
   end
 
+  def test_blank_root_directory_error_message
+    set_language_if_valid 'en'
+    repo = Repository::Filesystem.new(
+                          :project      => @project,
+                          :identifier   => 'test'
+                        )
+    assert !repo.save
+    assert_include "Root directory can't be blank",
+                   repo.errors.full_messages
+  end
+
+  def test_blank_root_directory_error_message_fr
+    set_language_if_valid 'fr'
+    str = "R\xc3\xa9pertoire racine doit \xc3\xaatre renseign\xc3\xa9(e)"
+    str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
+    repo = Repository::Filesystem.new(
+                          :project      => @project,
+                          :url          => "",
+                          :identifier   => 'test',
+                          :path_encoding => ''
+                        )
+    assert !repo.save
+    assert_include str, repo.errors.full_messages
+  end
+
   if File.directory?(REPOSITORY_PATH)
     def test_fetch_changesets
       assert_equal 0, @repository.changesets.count