Mercurial > hg > soundsoftware-site
comparison test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb @ 523:0b6c82dead28 luisf
Merge from branch "cannam"
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Mon, 25 Jul 2011 14:23:37 +0100 |
parents | cbce1fd3b1b7 |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
318:f7c525dc7585 | 523:0b6c82dead28 |
---|---|
1 # redMine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2008 Jean-Philippe Lang | 2 # Copyright (C) 2006-2011 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 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 | 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. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../../../../../test_helper' | 18 require File.expand_path('../../../../../../test_helper', __FILE__) |
19 | 19 |
20 class SubversionAdapterTest < ActiveSupport::TestCase | 20 begin |
21 | 21 require 'mocha' |
22 if repository_configured?('subversion') | 22 |
23 def test_client_version | 23 class SubversionAdapterTest < ActiveSupport::TestCase |
24 v = Redmine::Scm::Adapters::SubversionAdapter.client_version | 24 |
25 assert v.is_a?(Array) | 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 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 | |
26 end | 55 end |
27 else | 56 end |
28 puts "Subversion test repository NOT FOUND. Skipping unit tests !!!" | 57 |
29 def test_fake; assert true end | 58 rescue LoadError |
59 class SubversionMochaFake < ActiveSupport::TestCase | |
60 def test_fake; assert(false, "Requires mocha to run those tests") end | |
30 end | 61 end |
31 end | 62 end |