Commit fbd42e66 authored by tmaruyama's avatar tmaruyama

scm: git: add test to override human_attribute_name of "path to repository"

git-svn-id: https://svn.redmine.org/redmine/trunk@8963 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 30c03b55
...@@ -20,6 +20,8 @@ require File.expand_path('../../test_helper', __FILE__) ...@@ -20,6 +20,8 @@ require File.expand_path('../../test_helper', __FILE__)
class RepositoryGitTest < ActiveSupport::TestCase class RepositoryGitTest < ActiveSupport::TestCase
fixtures :projects, :repositories, :enabled_modules, :users, :roles fixtures :projects, :repositories, :enabled_modules, :users, :roles
include Redmine::I18n
REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
...@@ -57,6 +59,32 @@ class RepositoryGitTest < ActiveSupport::TestCase ...@@ -57,6 +59,32 @@ class RepositoryGitTest < ActiveSupport::TestCase
end end
end end
def test_blank_path_to_repository_error_message
set_language_if_valid 'en'
repo = Repository::Git.new(
:project => @project,
:identifier => 'test',
:log_encoding => 'UTF-8'
)
assert !repo.save
assert_include "Path to repository can't be blank",
repo.errors.full_messages
end
def test_blank_path_to_repository_error_message_fr
set_language_if_valid 'fr'
str = "Chemin du d\xc3\xa9p\xc3\xb4t doit \xc3\xaatre renseign\xc3\xa9(e)"
str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
repo = Repository::Git.new(
:project => @project,
:url => "",
:identifier => 'test',
:log_encoding => 'UTF-8'
)
assert !repo.save
assert_include str, repo.errors.full_messages
end
if File.directory?(REPOSITORY_PATH) if File.directory?(REPOSITORY_PATH)
def test_scm_available def test_scm_available
klass = Repository::Git klass = Repository::Git
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment