Mercurial > hg > soundsoftware-site
comparison test/unit/.svn/text-base/repository_cvs_test.rb.svn-base @ 0:513646585e45
* Import Redmine trunk SVN rev 3859
author | Chris Cannam |
---|---|
date | Fri, 23 Jul 2010 15:52:44 +0100 |
parents | |
children | af80e5618e9b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:513646585e45 |
---|---|
1 # redMine - project management software | |
2 # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
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 | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require File.dirname(__FILE__) + '/../test_helper' | |
19 require 'pp' | |
20 class RepositoryCvsTest < ActiveSupport::TestCase | |
21 fixtures :projects | |
22 | |
23 # No '..' in the repository path | |
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository' | |
25 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? | |
26 # CVS module | |
27 MODULE_NAME = 'test' | |
28 | |
29 def setup | |
30 @project = Project.find(1) | |
31 assert @repository = Repository::Cvs.create(:project => @project, | |
32 :root_url => REPOSITORY_PATH, | |
33 :url => MODULE_NAME) | |
34 end | |
35 | |
36 if File.directory?(REPOSITORY_PATH) | |
37 def test_fetch_changesets_from_scratch | |
38 @repository.fetch_changesets | |
39 @repository.reload | |
40 | |
41 assert_equal 5, @repository.changesets.count | |
42 assert_equal 14, @repository.changes.count | |
43 assert_not_nil @repository.changesets.find_by_comments('Two files changed') | |
44 end | |
45 | |
46 def test_fetch_changesets_incremental | |
47 @repository.fetch_changesets | |
48 # Remove the 3 latest changesets | |
49 @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy) | |
50 @repository.reload | |
51 assert_equal 2, @repository.changesets.count | |
52 | |
53 @repository.fetch_changesets | |
54 assert_equal 5, @repository.changesets.count | |
55 end | |
56 | |
57 def test_deleted_files_should_not_be_listed | |
58 entries = @repository.entries('sources') | |
59 assert entries.detect {|e| e.name == 'watchers_controller.rb'} | |
60 assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'} | |
61 end | |
62 else | |
63 puts "CVS test repository NOT FOUND. Skipping unit tests !!!" | |
64 def test_fake; assert true end | |
65 end | |
66 end |