comparison .svn/pristine/27/274f3b80c3fec339ad5a9fd2fdcdbd871a6ae2d1.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
comparison
equal deleted inserted replaced
1297:0a574315af3e 1298:4f746d8966dd
1 # Redmine - project management software
2 # Copyright (C) 2006-2013 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.expand_path('../../../../../../test_helper', __FILE__)
19 begin
20 require 'mocha'
21
22 class DarcsAdapterTest < ActiveSupport::TestCase
23 REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
24
25 if File.directory?(REPOSITORY_PATH)
26 def setup
27 @adapter = Redmine::Scm::Adapters::DarcsAdapter.new(REPOSITORY_PATH)
28 end
29
30 def test_darcsversion
31 to_test = { "1.0.9 (release)\n" => [1,0,9] ,
32 "2.2.0 (release)\n" => [2,2,0] }
33 to_test.each do |s, v|
34 test_darcsversion_for(s, v)
35 end
36 end
37
38 def test_revisions
39 id1 = '20080308225258-98289-761f654d669045eabee90b91b53a21ce5593cadf.gz'
40 revs = @adapter.revisions('', nil, nil, {:with_path => true})
41 assert_equal 6, revs.size
42 assert_equal id1, revs[5].scmid
43 paths = revs[5].paths
44 assert_equal 5, paths.size
45 assert_equal 'A', paths[0][:action]
46 assert_equal '/README', paths[0][:path]
47 assert_equal 'A', paths[1][:action]
48 assert_equal '/images', paths[1][:path]
49 end
50
51 private
52
53 def test_darcsversion_for(darcsversion, version)
54 @adapter.class.expects(:darcs_binary_version_from_command_line).returns(darcsversion)
55 assert_equal version, @adapter.class.darcs_binary_version
56 end
57
58 else
59 puts "Darcs test repository NOT FOUND. Skipping unit tests !!!"
60 def test_fake; assert true end
61 end
62 end
63
64 rescue LoadError
65 class DarcsMochaFake < ActiveSupport::TestCase
66 def test_fake; assert(false, "Requires mocha to run those tests") end
67 end
68 end
69