@@ -1,66 +1,66 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 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 | require 'pp' |
|
20 | 20 | class RepositoryCvsTest < 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/cvs_repository' |
|
25 | 25 | REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? |
|
26 | 26 | # CVS module |
|
27 | 27 | MODULE_NAME = 'test' |
|
28 | 28 | |
|
29 | 29 | def setup |
|
30 |
@project = Project.find( |
|
|
30 | @project = Project.find(3) | |
|
31 | 31 | assert @repository = Repository::Cvs.create(:project => @project, |
|
32 | 32 | :root_url => REPOSITORY_PATH, |
|
33 | 33 | :url => MODULE_NAME) |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | if File.directory?(REPOSITORY_PATH) |
|
37 | 37 | def test_fetch_changesets_from_scratch |
|
38 | 38 | @repository.fetch_changesets |
|
39 | 39 | @repository.reload |
|
40 | 40 | |
|
41 | 41 | assert_equal 5, @repository.changesets.count |
|
42 | 42 | assert_equal 14, @repository.changes.count |
|
43 | 43 | assert_not_nil @repository.changesets.find_by_comments('Two files changed') |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | def test_fetch_changesets_incremental |
|
47 | 47 | @repository.fetch_changesets |
|
48 | 48 | # Remove the 3 latest changesets |
|
49 | 49 | @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy) |
|
50 | 50 | @repository.reload |
|
51 | 51 | assert_equal 2, @repository.changesets.count |
|
52 | 52 | |
|
53 | 53 | @repository.fetch_changesets |
|
54 | 54 | assert_equal 5, @repository.changesets.count |
|
55 | 55 | end |
|
56 | 56 | |
|
57 | 57 | def test_deleted_files_should_not_be_listed |
|
58 | 58 | entries = @repository.entries('sources') |
|
59 | 59 | assert entries.detect {|e| e.name == 'watchers_controller.rb'} |
|
60 | 60 | assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'} |
|
61 | 61 | end |
|
62 | 62 | else |
|
63 | 63 | puts "CVS test repository NOT FOUND. Skipping unit tests !!!" |
|
64 | 64 | def test_fake; assert true end |
|
65 | 65 | end |
|
66 | 66 | end |
General Comments 0
You need to be logged in to leave comments.
Login now