+++ /dev/null
-
-require File.dirname(__FILE__) + '/../test_helper'
-
-
-class FilesystemAdapterTest < ActiveSupport::TestCase
-
- REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'
-
- if File.directory?(REPOSITORY_PATH)
- def setup
- @adapter = Redmine::Scm::Adapters::FilesystemAdapter.new(REPOSITORY_PATH)
- end
-
- def test_entries
- assert_equal 2, @adapter.entries.size
- assert_equal ["dir", "test"], @adapter.entries.collect(&:name)
- assert_equal ["dir", "test"], @adapter.entries(nil).collect(&:name)
- assert_equal ["dir", "test"], @adapter.entries("/").collect(&:name)
- ["dir", "/dir", "/dir/", "dir/"].each do |path|
- assert_equal ["subdir", "dirfile"], @adapter.entries(path).collect(&:name)
- end
- # If y try to use "..", the path is ignored
- ["/../","dir/../", "..", "../", "/..", "dir/.."].each do |path|
- assert_equal ["dir", "test"], @adapter.entries(path).collect(&:name), ".. must be ignored in path argument"
- end
- end
-
- def test_cat
- assert_equal "TEST CAT\n", @adapter.cat("test")
- assert_equal "TEST CAT\n", @adapter.cat("/test")
- # Revision number is ignored
- assert_equal "TEST CAT\n", @adapter.cat("/test", 1)
- end
-
- else
- puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS."
- def test_fake; assert true end
- end
-
-end
-
-
+++ /dev/null
-require File.dirname(__FILE__) + '/../test_helper'
-
-class GitAdapterTest < ActiveSupport::TestCase
- REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
-
- if File.directory?(REPOSITORY_PATH)
- def setup
- @adapter = Redmine::Scm::Adapters::GitAdapter.new(REPOSITORY_PATH)
- end
-
- def test_branches
- assert_equal @adapter.branches, ['master', 'test_branch']
- end
-
- def test_getting_all_revisions
- assert_equal 12, @adapter.revisions('',nil,nil,:all => true).length
- end
-
- def test_annotate
- annotate = @adapter.annotate('sources/watchers_controller.rb')
- assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
- assert_equal 41, annotate.lines.size
- assert_equal "# This program is free software; you can redistribute it and/or", annotate.lines[4].strip
- assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", annotate.revisions[4].identifier
- assert_equal "jsmith", annotate.revisions[4].author
- end
-
- def test_annotate_moved_file
- annotate = @adapter.annotate('renamed_test.txt')
- assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
- assert_equal 2, annotate.lines.size
- end
- else
- puts "Git test repository NOT FOUND. Skipping unit tests !!!"
- def test_fake; assert true end
- end
-end
--- /dev/null
+
+require File.dirname(__FILE__) + '/../../../../../test_helper'
+
+
+class FilesystemAdapterTest < ActiveSupport::TestCase
+
+ REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'
+
+ if File.directory?(REPOSITORY_PATH)
+ def setup
+ @adapter = Redmine::Scm::Adapters::FilesystemAdapter.new(REPOSITORY_PATH)
+ end
+
+ def test_entries
+ assert_equal 2, @adapter.entries.size
+ assert_equal ["dir", "test"], @adapter.entries.collect(&:name)
+ assert_equal ["dir", "test"], @adapter.entries(nil).collect(&:name)
+ assert_equal ["dir", "test"], @adapter.entries("/").collect(&:name)
+ ["dir", "/dir", "/dir/", "dir/"].each do |path|
+ assert_equal ["subdir", "dirfile"], @adapter.entries(path).collect(&:name)
+ end
+ # If y try to use "..", the path is ignored
+ ["/../","dir/../", "..", "../", "/..", "dir/.."].each do |path|
+ assert_equal ["dir", "test"], @adapter.entries(path).collect(&:name), ".. must be ignored in path argument"
+ end
+ end
+
+ def test_cat
+ assert_equal "TEST CAT\n", @adapter.cat("test")
+ assert_equal "TEST CAT\n", @adapter.cat("/test")
+ # Revision number is ignored
+ assert_equal "TEST CAT\n", @adapter.cat("/test", 1)
+ end
+
+ else
+ puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS."
+ def test_fake; assert true end
+ end
+
+end
+
+
--- /dev/null
+require File.dirname(__FILE__) + '/../../../../../test_helper'
+
+class GitAdapterTest < ActiveSupport::TestCase
+ REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
+
+ if File.directory?(REPOSITORY_PATH)
+ def setup
+ @adapter = Redmine::Scm::Adapters::GitAdapter.new(REPOSITORY_PATH)
+ end
+
+ def test_branches
+ assert_equal @adapter.branches, ['master', 'test_branch']
+ end
+
+ def test_getting_all_revisions
+ assert_equal 12, @adapter.revisions('',nil,nil,:all => true).length
+ end
+
+ def test_annotate
+ annotate = @adapter.annotate('sources/watchers_controller.rb')
+ assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
+ assert_equal 41, annotate.lines.size
+ assert_equal "# This program is free software; you can redistribute it and/or", annotate.lines[4].strip
+ assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", annotate.revisions[4].identifier
+ assert_equal "jsmith", annotate.revisions[4].author
+ end
+
+ def test_annotate_moved_file
+ annotate = @adapter.annotate('renamed_test.txt')
+ assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
+ assert_equal 2, annotate.lines.size
+ end
+ else
+ puts "Git test repository NOT FOUND. Skipping unit tests !!!"
+ def test_fake; assert true end
+ end
+end
--- /dev/null
+require File.dirname(__FILE__) + '/../../../../../test_helper'
+begin
+ require 'mocha'
+
+ class MercurialAdapterTest < ActiveSupport::TestCase
+
+ TEMPLATES_DIR = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATES_DIR
+ TEMPLATE_NAME = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_NAME
+ TEMPLATE_EXTENSION = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_EXTENSION
+
+ REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
+
+ def test_hgversion
+ to_test = { "0.9.5" => [0,9,5],
+ "1.0" => [1,0],
+ "1e4ddc9ac9f7+20080325" => nil,
+ "1.0.1+20080525" => [1,0,1],
+ "1916e629a29d" => nil}
+
+ to_test.each do |s, v|
+ test_hgversion_for(s, v)
+ end
+ end
+
+ def test_template_path
+ to_test = { [0,9,5] => "0.9.5",
+ [1,0] => "1.0",
+ [] => "1.0",
+ [1,0,1] => "1.0"}
+
+ to_test.each do |v, template|
+ test_template_path_for(v, template)
+ end
+ end
+
+ private
+
+ def test_hgversion_for(hgversion, version)
+ Redmine::Scm::Adapters::MercurialAdapter.expects(:hgversion_from_command_line).returns(hgversion)
+ adapter = Redmine::Scm::Adapters::MercurialAdapter
+ assert_equal version, adapter.hgversion
+ end
+
+ def test_template_path_for(version, template)
+ adapter = Redmine::Scm::Adapters::MercurialAdapter
+ assert_equal "#{TEMPLATES_DIR}/#{TEMPLATE_NAME}-#{template}.#{TEMPLATE_EXTENSION}", adapter.template_path_for(version)
+ assert File.exist?(adapter.template_path_for(version))
+ end
+ end
+
+rescue LoadError
+ def test_fake; assert(false, "Requires mocha to run those tests") end
+end
--- /dev/null
+# redMine - project management software
+# Copyright (C) 2006-2008 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require 'mkmf'
+
+require File.dirname(__FILE__) + '/../../../../../test_helper'
+
+class SubversionAdapterTest < ActiveSupport::TestCase
+
+ if find_executable0('svn')
+ def test_client_version
+ v = Redmine::Scm::Adapters::SubversionAdapter.client_version
+ assert v.is_a?(Array)
+ end
+ else
+ puts "Subversion binary NOT FOUND. Skipping unit tests !!!"
+ def test_fake; assert true end
+ end
+end
+++ /dev/null
-require File.dirname(__FILE__) + '/../test_helper'
-begin
- require 'mocha'
-
- class MercurialAdapterTest < ActiveSupport::TestCase
-
- TEMPLATES_DIR = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATES_DIR
- TEMPLATE_NAME = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_NAME
- TEMPLATE_EXTENSION = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_EXTENSION
-
- REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
-
- def test_hgversion
- to_test = { "0.9.5" => [0,9,5],
- "1.0" => [1,0],
- "1e4ddc9ac9f7+20080325" => nil,
- "1.0.1+20080525" => [1,0,1],
- "1916e629a29d" => nil}
-
- to_test.each do |s, v|
- test_hgversion_for(s, v)
- end
- end
-
- def test_template_path
- to_test = { [0,9,5] => "0.9.5",
- [1,0] => "1.0",
- [] => "1.0",
- [1,0,1] => "1.0"}
-
- to_test.each do |v, template|
- test_template_path_for(v, template)
- end
- end
-
- private
-
- def test_hgversion_for(hgversion, version)
- Redmine::Scm::Adapters::MercurialAdapter.expects(:hgversion_from_command_line).returns(hgversion)
- adapter = Redmine::Scm::Adapters::MercurialAdapter
- assert_equal version, adapter.hgversion
- end
-
- def test_template_path_for(version, template)
- adapter = Redmine::Scm::Adapters::MercurialAdapter
- assert_equal "#{TEMPLATES_DIR}/#{TEMPLATE_NAME}-#{template}.#{TEMPLATE_EXTENSION}", adapter.template_path_for(version)
- assert File.exist?(adapter.template_path_for(version))
- end
- end
-
-rescue LoadError
- def test_fake; assert(false, "Requires mocha to run those tests") end
-end
+++ /dev/null
-# redMine - project management software
-# Copyright (C) 2006-2008 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-require 'mkmf'
-
-require File.dirname(__FILE__) + '/../test_helper'
-
-class SubversionAdapterTest < ActiveSupport::TestCase
-
- if find_executable0('svn')
- def test_client_version
- v = Redmine::Scm::Adapters::SubversionAdapter.client_version
- assert v.is_a?(Array)
- end
- else
- puts "Subversion binary NOT FOUND. Skipping unit tests !!!"
- def test_fake; assert true end
- end
-end