##// END OF EJS Templates
scm: filesystem: code clean up unit model test....
Toshi MARUYAMA -
r5742:7296315c9520
parent child
Show More
@@ -1,55 +1,56
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RepositoryFilesystemTest < ActiveSupport::TestCase
21 21 fixtures :projects
22 22
23 23 # No '..' in the repository path
24 24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'
25 25
26 26 def setup
27 27 @project = Project.find(3)
28 28 Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem')
29 assert @repository = Repository::Filesystem.create(
30 :project => @project, :url => REPOSITORY_PATH)
29 @repository = Repository::Filesystem.create(
30 :project => @project,
31 :url => REPOSITORY_PATH
32 )
33 assert @repository
31 34 end
32 35
33 36 if File.directory?(REPOSITORY_PATH)
34 37 def test_fetch_changesets
35 38 @repository.fetch_changesets
36 39 @repository.reload
37
38 40 assert_equal 0, @repository.changesets.count
39 41 assert_equal 0, @repository.changes.count
40 42 end
41 43
42 44 def test_entries
43 45 assert_equal 3, @repository.entries("", 2).size
44 46 assert_equal 2, @repository.entries("dir", 3).size
45 47 end
46 48
47 49 def test_cat
48 50 assert_equal "TEST CAT\n", @repository.scm.cat("test")
49 51 end
50
51 52 else
52 53 puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS."
53 54 def test_fake; assert true end
54 55 end
55 56 end
General Comments 0
You need to be logged in to leave comments. Login now