To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / .svn / pristine / 79 / 79ebb49968818fca414e007a7d073ecb0152e756.svn-base @ 1297:0a574315af3e

History | View | Annotate | Download (2.38 KB)

1
# Redmine - project management software
2
# Copyright (C) 2006-2011  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

    
20
begin
21
  require 'mocha'
22

    
23
  class SubversionAdapterTest < ActiveSupport::TestCase
24

    
25
    if repository_configured?('subversion')
26
      def setup
27
        @adapter = Redmine::Scm::Adapters::SubversionAdapter.new(self.class.subversion_repository_url)
28
      end
29

    
30
      def test_client_version
31
        v = Redmine::Scm::Adapters::SubversionAdapter.client_version
32
        assert v.is_a?(Array)
33
      end
34

    
35
      def test_scm_version
36
        to_test = { "svn, version 1.6.13 (r1002816)\n"  => [1,6,13],
37
                    "svn, versione 1.6.13 (r1002816)\n" => [1,6,13],
38
                    "1.6.1\n1.7\n1.8"                   => [1,6,1],
39
                    "1.6.2\r\n1.8.1\r\n1.9.1"           => [1,6,2]}
40
        to_test.each do |s, v|
41
          test_scm_version_for(s, v)
42
        end
43
      end
44

    
45
      def test_info_not_nil
46
        assert_not_nil @adapter.info
47
      end
48

    
49
      def test_info_nil
50
        adpt = Redmine::Scm::Adapters::SubversionAdapter.new(
51
                  "file:///invalid/invalid/"
52
                  )
53
        assert_nil adpt.info
54
      end
55

    
56
      private
57

    
58
      def test_scm_version_for(scm_version, version)
59
        @adapter.class.expects(:scm_version_from_command_line).returns(scm_version)
60
        assert_equal version, @adapter.class.svn_binary_version
61
      end
62
    else
63
      puts "Subversion test repository NOT FOUND. Skipping unit tests !!!"
64
      def test_fake; assert true end
65
    end
66
  end
67
rescue LoadError
68
  class SubversionMochaFake < ActiveSupport::TestCase
69
    def test_fake; assert(false, "Requires mocha to run those tests")  end
70
  end
71
end