Added 'Bulk edit' functionality.
[gitredmine.git] / test / unit / repository_subversion_test.rb
blobdd1c5eb6ee5434aa8ccdda608070d2b51f9c855f
1 # redMine - project management software
2 # Copyright (C) 2006-2007  Jean-Philippe Lang
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.
18 require File.dirname(__FILE__) + '/../test_helper'
20 class RepositorySubversionTest < Test::Unit::TestCase
21   fixtures :projects
22   
23   # No '..' in the repository path for svn
24   REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
25   
26   def setup
27     @project = Project.find(1)
28     assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}")
29   end
30   
31   if File.directory?(REPOSITORY_PATH)  
32     def test_fetch_changesets_from_scratch
33       @repository.fetch_changesets
34       @repository.reload
35       
36       assert_equal 8, @repository.changesets.count
37       assert_equal 16, @repository.changes.count
38       assert_equal 'Initial import.', @repository.changesets.find_by_revision(1).comments
39     end
40     
41     def test_fetch_changesets_incremental
42       @repository.fetch_changesets
43       # Remove changesets with revision > 5
44       @repository.changesets.find(:all, :conditions => 'revision > 5').each(&:destroy)
45       @repository.reload
46       assert_equal 5, @repository.changesets.count
47       
48       @repository.fetch_changesets
49       assert_equal 8, @repository.changesets.count
50     end
51   else
52     puts "Subversion test repository NOT FOUND. Skipping tests !!!"
53     def test_fake; assert false end
54   end
55 end