##// END OF EJS Templates
scm: git: refactor lastrev() in adapter....
scm: git: refactor lastrev() in adapter. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4963 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r4682:109fd2cdfc88
r4843:06c9eea67a80
Show More
repository_cvs_test.rb
94 lines | 3.8 KiB | text/x-ruby | RubyLexer
/ test / unit / repository_cvs_test.rb
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 # redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 require 'pp'
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class RepositoryCvsTest < ActiveSupport::TestCase
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 fixtures :projects
# No '..' in the repository path
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
Jean-Philippe Lang
Fixes platform determination under JRuby (#1804)....
r1752 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 # CVS module
MODULE_NAME = 'test'
def setup
Toshi MARUYAMA
scm: cvs: change project id of unit app test from 1 to 3....
r4668 @project = Project.find(3)
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 assert @repository = Repository::Cvs.create(:project => @project,
:root_url => REPOSITORY_PATH,
:url => MODULE_NAME)
end
if File.directory?(REPOSITORY_PATH)
def test_fetch_changesets_from_scratch
Toshi MARUYAMA
scm: cvs: add fetch_changesets at all unit app test methods....
r4671 assert_equal 0, @repository.changesets.count
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 @repository.fetch_changesets
@repository.reload
assert_equal 5, @repository.changesets.count
assert_equal 14, @repository.changes.count
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_not_nil @repository.changesets.find_by_comments('Two files changed')
Toshi MARUYAMA
scm: cvs: generate pseudo scmid for auto issue close text (#6706)....
r4682
r2 = @repository.changesets.find_by_revision('2')
assert_equal 'v1-20071213-162510', r2.scmid
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 end
def test_fetch_changesets_incremental
Toshi MARUYAMA
scm: cvs: add fetch_changesets at all unit app test methods....
r4671 assert_equal 0, @repository.changesets.count
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 @repository.fetch_changesets
Toshi MARUYAMA
scm: cvs: change temporary revision number from "_N" to "tmpN" (#996, #3761, #6706)....
r4681 # Remove changesets with revision > 3
@repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 3}
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 @repository.reload
Toshi MARUYAMA
scm: cvs: change temporary revision number from "_N" to "tmpN" (#996, #3761, #6706)....
r4681 assert_equal 3, @repository.changesets.count
assert_equal %w|3 2 1|, @repository.changesets.collect(&:revision)
rev3_commit = @repository.changesets.find(:first, :order => 'committed_on DESC')
assert_equal '3', rev3_commit.revision
# 2007-12-14 01:27:22 +0900
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22)
Toshi MARUYAMA
scm: cvs: generate pseudo scmid for auto issue close text (#6706)....
r4682 assert_equal 'HEAD-20071213-162722', rev3_commit.scmid
Toshi MARUYAMA
scm: cvs: change temporary revision number from "_N" to "tmpN" (#996, #3761, #6706)....
r4681 assert_equal rev3_committed_on, rev3_commit.committed_on
latest_rev = @repository.latest_changeset
assert_equal rev3_committed_on, latest_rev.committed_on
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 @repository.fetch_changesets
Toshi MARUYAMA
scm: cvs: change temporary revision number from "_N" to "tmpN" (#996, #3761, #6706)....
r4681 @repository.reload
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 assert_equal 5, @repository.changesets.count
Toshi MARUYAMA
scm: cvs: change temporary revision number from "_N" to "tmpN" (#996, #3761, #6706)....
r4681
assert_equal %w|5 4 3 2 1|, @repository.changesets.collect(&:revision)
rev5_commit = @repository.changesets.find(:first, :order => 'committed_on DESC')
Toshi MARUYAMA
scm: cvs: generate pseudo scmid for auto issue close text (#6706)....
r4682 assert_equal 'HEAD-20071213-163001', rev5_commit.scmid
Toshi MARUYAMA
scm: cvs: change temporary revision number from "_N" to "tmpN" (#996, #3761, #6706)....
r4681 # 2007-12-14 01:30:01 +0900
rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1)
assert_equal rev5_committed_on, rev5_commit.committed_on
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 end
Jean-Philippe Lang
Fixed: CVS browser should not show dead revisions (deleted files) (#2319)....
r2133
def test_deleted_files_should_not_be_listed
Toshi MARUYAMA
scm: cvs: add fetch_changesets at all unit app test methods....
r4671 assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@repository.reload
assert_equal 5, @repository.changesets.count
Jean-Philippe Lang
Fixed: CVS browser should not show dead revisions (deleted files) (#2319)....
r2133 entries = @repository.entries('sources')
assert entries.detect {|e| e.name == 'watchers_controller.rb'}
assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
end
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 else
puts "CVS test repository NOT FOUND. Skipping unit tests !!!"
def test_fake; assert true end
end
end