Commit 3336766e authored by jplang's avatar jplang

Adds test helpers for test repositories.

git-svn-id: https://svn.redmine.org/redmine/trunk@3720 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 3e53c29d
......@@ -26,9 +26,6 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
:repositories, :issues, :issue_statuses, :changesets, :changes,
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
# No '..' in the repository path for svn
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
def setup
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
......@@ -37,7 +34,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
User.current = nil
end
if File.directory?(REPOSITORY_PATH)
if repository_configured?('subversion')
def test_show
get :show, :id => 1
assert_response :success
......
......@@ -83,6 +83,16 @@ class ActiveSupport::TestCase
# LDAP is not listening
return nil
end
# Returns the path to the test +vendor+ repository
def self.repository_path(vendor)
File.join(RAILS_ROOT.gsub(%r{config\/\.\.}, ''), "/tmp/test/#{vendor.downcase}_repository")
end
# Returns true if the +vendor+ test repository is configured
def self.repository_configured?(vendor)
File.directory?(repository_path(vendor))
end
# Shoulda macros
def self.should_render_404
......
......@@ -15,19 +15,17 @@
# 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')
if repository_configured?('subversion')
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 !!!"
puts "Subversion test repository NOT FOUND. Skipping unit tests !!!"
def test_fake; assert true end
end
end
......@@ -20,15 +20,12 @@ require File.dirname(__FILE__) + '/../test_helper'
class RepositorySubversionTest < ActiveSupport::TestCase
fixtures :projects
# No '..' in the repository path for svn
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
def setup
@project = Project.find(1)
assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}")
assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{self.class.repository_path('subversion')}")
end
if File.directory?(REPOSITORY_PATH)
if repository_configured?('subversion')
def test_fetch_changesets_from_scratch
@repository.fetch_changesets
@repository.reload
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment