add unit tests of subversion url validation

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11717 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2013-04-14 15:31:18 +00:00
parent 5d05de4b09
commit 7a18920728
1 changed files with 28 additions and 0 deletions

View File

@ -20,6 +20,8 @@ require File.expand_path('../../test_helper', __FILE__)
class RepositorySubversionTest < ActiveSupport::TestCase
fixtures :projects, :repositories, :enabled_modules, :users, :roles
include Redmine::I18n
NUM_REV = 11
def setup
@ -29,6 +31,32 @@ class RepositorySubversionTest < ActiveSupport::TestCase
assert @repository
end
def test_invalid_url
set_language_if_valid 'en'
['invalid', 'http://', 'svn://', 'svn+ssh://', 'file://'].each do |url|
repo = Repository::Subversion.new(
:project => @project,
:identifier => 'test',
:url => url
)
assert !repo.save
assert_include "is invalid", repo.errors[:url]
end
end
def test_valid_url
['http://valid', 'svn://valid', 'svn+ssh://valid', 'file://valid'].each do |url|
repo = Repository::Subversion.new(
:project => @project,
:identifier => 'test',
:url => url
)
assert repo.save
assert_equal [], repo.errors[:url]
assert repo.destroy
end
end
if repository_configured?('subversion')
def test_fetch_changesets_from_scratch
assert_equal 0, @repository.changesets.count