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:
1 parent
5d05de4b09
commit
7a18920728
1 file changed
+28
@@ -20,6 +20,8 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class RepositorySubversionTest < ActiveSupport::TestCase
|
class RepositorySubversionTest < ActiveSupport::TestCase
|
||||||
fixtures :projects, :repositories, :enabled_modules, :users, :roles
|
fixtures :projects, :repositories, :enabled_modules, :users, :roles
|
||||||
|
|
||||||
|
include Redmine::I18n
|
||||||
|
|
||||||
NUM_REV = 11
|
NUM_REV = 11
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@@ -29,6 +31,32 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
|||||||
assert @repository
|
assert @repository
|
||||||
end
|
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')
|
if repository_configured?('subversion')
|
||||||
def test_fetch_changesets_from_scratch
|
def test_fetch_changesets_from_scratch
|
||||||
assert_equal 0, @repository.changesets.count
|
assert_equal 0, @repository.changesets.count
|
||||||
|
|||||||
Reference in new issue
Block a user