2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# Copyright (C) 2010-2011 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
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-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
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)
|
2011-05-25 19:11:16 +04:00
|
|
|
Setting.enabled_scm = Setting.enabled_scm.dup << '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-30 22:52: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
|