summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-02-24 14:02:26 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-02-24 14:02:26 +0000
commit1f2f32f58c8c2646a6e8ea8d8dd7ee03e537b067 (patch)
tree32c9a12a5f6b31f46f202bb2f543c8f0f07ae478
parente323a0c20c27b5fd51a1c446dbb8fa2ae47f19d6 (diff)
downloadredmine-1f2f32f58c8c2646a6e8ea8d8dd7ee03e537b067.tar.gz
redmine-1f2f32f58c8c2646a6e8ea8d8dd7ee03e537b067.zip
scm: cvs: add test to override human_attribute_name
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8968 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/unit/repository_cvs_test.rb60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb
index f9a6a5a54..a616a2c09 100644
--- a/test/unit/repository_cvs_test.rb
+++ b/test/unit/repository_cvs_test.rb
@@ -20,6 +20,8 @@ require 'pp'
class RepositoryCvsTest < ActiveSupport::TestCase
fixtures :projects
+ include Redmine::I18n
+
REPOSITORY_PATH = Rails.root.join('tmp/test/cvs_repository').to_s
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
# CVS module
@@ -35,6 +37,64 @@ class RepositoryCvsTest < ActiveSupport::TestCase
assert @repository
end
+ def test_blank_module_error_message
+ set_language_if_valid 'en'
+ repo = Repository::Cvs.new(
+ :project => @project,
+ :identifier => 'test',
+ :log_encoding => 'UTF-8',
+ :root_url => REPOSITORY_PATH
+ )
+ assert !repo.save
+ assert_include "Module can't be blank",
+ repo.errors.full_messages
+ end
+
+ def test_blank_module_error_message_fr
+ set_language_if_valid 'fr'
+ str = "Module doit \xc3\xaatre renseign\xc3\xa9(e)"
+ str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
+ repo = Repository::Cvs.new(
+ :project => @project,
+ :identifier => 'test',
+ :log_encoding => 'UTF-8',
+ :path_encoding => '',
+ :url => '',
+ :root_url => REPOSITORY_PATH
+ )
+ assert !repo.save
+ assert_include str, repo.errors.full_messages
+ end
+
+ def test_blank_cvsroot_error_message
+ set_language_if_valid 'en'
+ repo = Repository::Cvs.new(
+ :project => @project,
+ :identifier => 'test',
+ :log_encoding => 'UTF-8',
+ :url => MODULE_NAME
+ )
+ assert !repo.save
+ assert_include "CVSROOT can't be blank",
+ repo.errors.full_messages
+ end
+
+ def test_blank_cvsroot_error_message_fr
+ set_language_if_valid 'fr'
+ str = "CVSROOT doit \xc3\xaatre renseign\xc3\xa9(e)"
+ str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
+ repo = Repository::Cvs.new(
+ :project => @project,
+ :identifier => 'test',
+ :log_encoding => 'UTF-8',
+ :path_encoding => '',
+ :url => MODULE_NAME,
+ :root_url => ''
+ )
+ assert !repo.save
+ assert_include str, repo.errors.full_messages
+ end
+
if File.directory?(REPOSITORY_PATH)
def test_fetch_changesets_from_scratch
assert_equal 0, @repository.changesets.count