summaryrefslogtreecommitdiffstats
path: root/test/unit/repository_cvs_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-08 10:52:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-08 10:52:59 +0000
commit13f9ccaed853654df5cfb990884345b513f0b88c (patch)
tree7e7bc0be36a46b5e87032e89862f56894f68f422 /test/unit/repository_cvs_test.rb
parent34bb545e4f327d24bd81a0bdb4ec02c6fb6ee0e7 (diff)
downloadredmine-13f9ccaed853654df5cfb990884345b513f0b88c.tar.gz
redmine-13f9ccaed853654df5cfb990884345b513f0b88c.zip
Adds configuration settings to limit valid repository path (#1415).
git-svn-id: http://svn.redmine.org/redmine/trunk@13573 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/repository_cvs_test.rb')
-rw-r--r--test/unit/repository_cvs_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb
index 8b5ac6271..fec41329a 100644
--- a/test/unit/repository_cvs_test.rb
+++ b/test/unit/repository_cvs_test.rb
@@ -93,6 +93,24 @@ class RepositoryCvsTest < ActiveSupport::TestCase
assert_include str, repo.errors.full_messages
end
+ def test_root_url_should_be_validated_against_regexp_set_in_configuration
+ Redmine::Configuration.with 'scm_cvs_path_regexp' => '/cvspath/[a-z]+' do
+ repo = Repository::Cvs.new(
+ :project => @project,
+ :identifier => 'test',
+ :log_encoding => 'UTF-8',
+ :path_encoding => '',
+ :url => MODULE_NAME
+ )
+ repo.root_url = '/wrong_path'
+ assert !repo.valid?
+ assert repo.errors[:root_url].present?
+
+ repo.root_url = '/cvspath/foo'
+ assert repo.valid?
+ end
+ end
+
if File.directory?(REPOSITORY_PATH)
def test_fetch_changesets_from_scratch
assert_equal 0, @repository.changesets.count