2011-05-08 09:09:25 +04:00
|
|
|
# Redmine - project management software
|
|
|
|
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
2008-06-08 19:40:24 +04:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-05-08 09:09:25 +04:00
|
|
|
#
|
2008-06-08 19:40:24 +04:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2011-05-08 09:09:25 +04:00
|
|
|
#
|
2008-06-08 19:40:24 +04:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
2010-12-13 02:24:34 +03:00
|
|
|
require File.expand_path('../../test_helper', __FILE__)
|
2008-06-08 19:40:24 +04:00
|
|
|
|
2009-09-13 21:14:35 +04:00
|
|
|
class RepositoryFilesystemTest < ActiveSupport::TestCase
|
2008-06-08 19:40:24 +04:00
|
|
|
fixtures :projects
|
2011-03-22 08:47:24 +03:00
|
|
|
|
2008-06-08 19:40:24 +04:00
|
|
|
# No '..' in the repository path
|
|
|
|
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'
|
2011-03-22 08:47:24 +03:00
|
|
|
|
2008-06-08 19:40:24 +04:00
|
|
|
def setup
|
2011-03-22 08:48:06 +03:00
|
|
|
@project = Project.find(3)
|
2008-06-08 19:40:24 +04:00
|
|
|
Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem')
|
2011-03-22 08:47:24 +03:00
|
|
|
assert @repository = Repository::Filesystem.create(
|
|
|
|
:project => @project, :url => REPOSITORY_PATH)
|
2008-06-08 19:40:24 +04:00
|
|
|
end
|
2011-03-22 08:47:24 +03:00
|
|
|
|
2011-05-08 09:09:25 +04:00
|
|
|
if File.directory?(REPOSITORY_PATH)
|
2008-06-08 19:40:24 +04:00
|
|
|
def test_fetch_changesets
|
|
|
|
@repository.fetch_changesets
|
|
|
|
@repository.reload
|
2011-03-22 08:47:24 +03:00
|
|
|
|
2008-06-08 19:40:24 +04:00
|
|
|
assert_equal 0, @repository.changesets.count
|
|
|
|
assert_equal 0, @repository.changes.count
|
|
|
|
end
|
2011-03-22 08:47:24 +03:00
|
|
|
|
2008-06-08 19:40:24 +04:00
|
|
|
def test_entries
|
2011-03-22 18:30:19 +03:00
|
|
|
assert_equal 3, @repository.entries("", 2).size
|
2008-06-08 19:40:24 +04:00
|
|
|
assert_equal 2, @repository.entries("dir", 3).size
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_cat
|
|
|
|
assert_equal "TEST CAT\n", @repository.scm.cat("test")
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS."
|
|
|
|
def test_fake; assert true end
|
|
|
|
end
|
|
|
|
end
|