annotate test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb @ 857:a1a87bc044b8 feature_199

Close obsolete branch feature_199
author Chris Cannam
date Wed, 13 Jul 2011 11:51:42 +0100
parents cbce1fd3b1b7
children cbb26bc654de
rev   line source
Chris@441 1 # Redmine - project management software
Chris@441 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@0 3 #
Chris@0 4 # This program is free software; you can redistribute it and/or
Chris@0 5 # modify it under the terms of the GNU General Public License
Chris@0 6 # as published by the Free Software Foundation; either version 2
Chris@0 7 # of the License, or (at your option) any later version.
Chris@441 8 #
Chris@0 9 # This program is distributed in the hope that it will be useful,
Chris@0 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 12 # GNU General Public License for more details.
Chris@441 13 #
Chris@0 14 # You should have received a copy of the GNU General Public License
Chris@0 15 # along with this program; if not, write to the Free Software
Chris@0 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@0 17
Chris@119 18 require File.expand_path('../../../../../../test_helper', __FILE__)
Chris@0 19
Chris@245 20 begin
Chris@245 21 require 'mocha'
Chris@245 22
Chris@245 23 class SubversionAdapterTest < ActiveSupport::TestCase
Chris@441 24
Chris@245 25 if repository_configured?('subversion')
Chris@245 26 def setup
Chris@441 27 @adapter = Redmine::Scm::Adapters::SubversionAdapter.new(self.class.subversion_repository_url)
Chris@245 28 end
Chris@245 29
Chris@245 30 def test_client_version
Chris@245 31 v = Redmine::Scm::Adapters::SubversionAdapter.client_version
Chris@245 32 assert v.is_a?(Array)
Chris@245 33 end
Chris@245 34
Chris@245 35 def test_scm_version
Chris@245 36 to_test = { "svn, version 1.6.13 (r1002816)\n" => [1,6,13],
Chris@245 37 "svn, versione 1.6.13 (r1002816)\n" => [1,6,13],
Chris@245 38 "1.6.1\n1.7\n1.8" => [1,6,1],
Chris@245 39 "1.6.2\r\n1.8.1\r\n1.9.1" => [1,6,2]}
Chris@245 40 to_test.each do |s, v|
Chris@245 41 test_scm_version_for(s, v)
Chris@245 42 end
Chris@245 43 end
Chris@245 44
Chris@245 45 private
Chris@245 46
Chris@245 47 def test_scm_version_for(scm_version, version)
Chris@245 48 @adapter.class.expects(:scm_version_from_command_line).returns(scm_version)
Chris@245 49 assert_equal version, @adapter.class.svn_binary_version
Chris@245 50 end
Chris@245 51
Chris@245 52 else
Chris@245 53 puts "Subversion test repository NOT FOUND. Skipping unit tests !!!"
Chris@245 54 def test_fake; assert true end
Chris@0 55 end
Chris@245 56 end
Chris@245 57
Chris@245 58 rescue LoadError
Chris@245 59 class SubversionMochaFake < ActiveSupport::TestCase
Chris@245 60 def test_fake; assert(false, "Requires mocha to run those tests") end
Chris@0 61 end
Chris@0 62 end