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 / test / unit / lib / redmine / scm / adapters / .svn / text-base / subversion_adapter_test.rb.svn-base @ 441:cbce1fd3b1b7

History | View | Annotate | Download (2.12 KB)

1 441:cbce1fd3b1b7 Chris
# Redmine - project management software
2
# Copyright (C) 2006-2011  Jean-Philippe Lang
3 0:513646585e45 Chris
#
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 441:cbce1fd3b1b7 Chris
#
9 0:513646585e45 Chris
# 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 441:cbce1fd3b1b7 Chris
#
14 0:513646585e45 Chris
# 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 119:8661b858af72 Chris
require File.expand_path('../../../../../../test_helper', __FILE__)
19 0:513646585e45 Chris
20 245:051f544170fe Chris
begin
21
  require 'mocha'
22
23
  class SubversionAdapterTest < ActiveSupport::TestCase
24 441:cbce1fd3b1b7 Chris
25 245:051f544170fe Chris
    if repository_configured?('subversion')
26
      def setup
27 441:cbce1fd3b1b7 Chris
        @adapter = Redmine::Scm::Adapters::SubversionAdapter.new(self.class.subversion_repository_url)
28 245:051f544170fe Chris
      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
      private
46
47
      def test_scm_version_for(scm_version, version)
48
        @adapter.class.expects(:scm_version_from_command_line).returns(scm_version)
49
        assert_equal version, @adapter.class.svn_binary_version
50
      end
51
52
    else
53
      puts "Subversion test repository NOT FOUND. Skipping unit tests !!!"
54
      def test_fake; assert true end
55 0:513646585e45 Chris
    end
56 245:051f544170fe Chris
  end
57
58
rescue LoadError
59
  class SubversionMochaFake < ActiveSupport::TestCase
60
    def test_fake; assert(false, "Requires mocha to run those tests")  end
61 0:513646585e45 Chris
  end
62
end