##// END OF EJS Templates
Adds test helpers for test repositories....
Jean-Philippe Lang -
r3606:1be15816dd30
parent child
Show More
@@ -26,9 +26,6 class RepositoriesSubversionControllerTest < ActionController::TestCase
26 26 :repositories, :issues, :issue_statuses, :changesets, :changes,
27 27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
28 28
29 # No '..' in the repository path for svn
30 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
31
32 29 def setup
33 30 @controller = RepositoriesController.new
34 31 @request = ActionController::TestRequest.new
@@ -37,7 +34,7 class RepositoriesSubversionControllerTest < ActionController::TestCase
37 34 User.current = nil
38 35 end
39 36
40 if File.directory?(REPOSITORY_PATH)
37 if repository_configured?('subversion')
41 38 def test_show
42 39 get :show, :id => 1
43 40 assert_response :success
@@ -84,6 +84,16 class ActiveSupport::TestCase
84 84 return nil
85 85 end
86 86
87 # Returns the path to the test +vendor+ repository
88 def self.repository_path(vendor)
89 File.join(RAILS_ROOT.gsub(%r{config\/\.\.}, ''), "/tmp/test/#{vendor.downcase}_repository")
90 end
91
92 # Returns true if the +vendor+ test repository is configured
93 def self.repository_configured?(vendor)
94 File.directory?(repository_path(vendor))
95 end
96
87 97 # Shoulda macros
88 98 def self.should_render_404
89 99 should_respond_with :not_found
@@ -15,19 +15,17
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 require 'mkmf'
19
20 18 require File.dirname(__FILE__) + '/../../../../../test_helper'
21 19
22 20 class SubversionAdapterTest < ActiveSupport::TestCase
23 21
24 if find_executable0('svn')
22 if repository_configured?('subversion')
25 23 def test_client_version
26 24 v = Redmine::Scm::Adapters::SubversionAdapter.client_version
27 25 assert v.is_a?(Array)
28 26 end
29 27 else
30 puts "Subversion binary NOT FOUND. Skipping unit tests !!!"
28 puts "Subversion test repository NOT FOUND. Skipping unit tests !!!"
31 29 def test_fake; assert true end
32 30 end
33 31 end
@@ -20,15 +20,12 require File.dirname(__FILE__) + '/../test_helper'
20 20 class RepositorySubversionTest < ActiveSupport::TestCase
21 21 fixtures :projects
22 22
23 # No '..' in the repository path for svn
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
25
26 23 def setup
27 24 @project = Project.find(1)
28 assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}")
25 assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{self.class.repository_path('subversion')}")
29 26 end
30 27
31 if File.directory?(REPOSITORY_PATH)
28 if repository_configured?('subversion')
32 29 def test_fetch_changesets_from_scratch
33 30 @repository.fetch_changesets
34 31 @repository.reload
General Comments 0
You need to be logged in to leave comments. Login now