Mercurial > hg > soundsoftware-site
comparison test/unit/repository_filesystem_test.rb @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 8661b858af72 |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
1 # redMine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2007 Jean-Philippe Lang | 2 # Copyright (C) 2006-2011 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program; if not, write to the Free Software | 15 # along with this program; if not, write to the Free Software |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.expand_path('../../test_helper', __FILE__) | 18 require File.expand_path('../../test_helper', __FILE__) |
19 | 19 |
20 class RepositoryFilesystemTest < ActiveSupport::TestCase | 20 class RepositoryFilesystemTest < ActiveSupport::TestCase |
21 fixtures :projects | 21 fixtures :projects |
22 | 22 |
23 # No '..' in the repository path | 23 # No '..' in the repository path |
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository' | 24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository' |
25 | 25 |
26 def setup | 26 def setup |
27 @project = Project.find(1) | 27 @project = Project.find(3) |
28 Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem') | 28 Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem') |
29 assert @repository = Repository::Filesystem.create(:project => @project, :url => REPOSITORY_PATH) | 29 @repository = Repository::Filesystem.create( |
30 :project => @project, | |
31 :url => REPOSITORY_PATH | |
32 ) | |
33 assert @repository | |
30 end | 34 end |
31 | 35 |
32 if File.directory?(REPOSITORY_PATH) | 36 if File.directory?(REPOSITORY_PATH) |
33 def test_fetch_changesets | 37 def test_fetch_changesets |
34 @repository.fetch_changesets | 38 @repository.fetch_changesets |
35 @repository.reload | 39 @repository.reload |
36 | |
37 assert_equal 0, @repository.changesets.count | 40 assert_equal 0, @repository.changesets.count |
38 assert_equal 0, @repository.changes.count | 41 assert_equal 0, @repository.changes.count |
39 end | 42 end |
40 | 43 |
41 def test_entries | 44 def test_entries |
42 assert_equal 2, @repository.entries("", 2).size | 45 assert_equal 3, @repository.entries("", 2).size |
43 assert_equal 2, @repository.entries("dir", 3).size | 46 assert_equal 2, @repository.entries("dir", 3).size |
44 end | 47 end |
45 | 48 |
46 def test_cat | 49 def test_cat |
47 assert_equal "TEST CAT\n", @repository.scm.cat("test") | 50 assert_equal "TEST CAT\n", @repository.scm.cat("test") |
48 end | 51 end |
49 | |
50 else | 52 else |
51 puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS." | 53 puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS." |
52 def test_fake; assert true end | 54 def test_fake; assert true end |
53 end | 55 end |
54 end | 56 end |