diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-04-14 15:31:18 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-04-14 15:31:18 +0000 |
commit | 7a189207283f3a5f32efc3ab703292a5e6fd053a (patch) | |
tree | 07956385edf2f3bdb37cca157b95f047c775e1da /test/unit/repository_subversion_test.rb | |
parent | 5d05de4b09d098616631168bd27ee07d6db0f1d6 (diff) | |
download | redmine-7a189207283f3a5f32efc3ab703292a5e6fd053a.tar.gz redmine-7a189207283f3a5f32efc3ab703292a5e6fd053a.zip |
add unit tests of subversion url validation
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11717 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/repository_subversion_test.rb')
-rw-r--r-- | test/unit/repository_subversion_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb index 9e9cdac9d..674083fdc 100644 --- a/test/unit/repository_subversion_test.rb +++ b/test/unit/repository_subversion_test.rb @@ -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 |