From 2b79e05e6c528fd2e4959a9547b003695e264c21 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 2 Feb 2011 04:00:59 +0000 Subject: [PATCH] scm: cvs: change project id of functional test from 1 to 3. Project id 1 has Subversion fixtures. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4789 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../repositories_cvs_controller_test.rb | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb index 58b44ec14..5e2a1dc91 100644 --- a/test/functional/repositories_cvs_controller_test.rb +++ b/test/functional/repositories_cvs_controller_test.rb @@ -29,7 +29,8 @@ class RepositoriesCvsControllerTest < ActionController::TestCase REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? # CVS module MODULE_NAME = 'test' - + PRJ_ID = 3 + def setup @controller = RepositoriesController.new @request = ActionController::TestRequest.new @@ -37,14 +38,18 @@ class RepositoriesCvsControllerTest < ActionController::TestCase Setting.default_language = 'en' User.current = nil - @project = Project.find(1) - @project.repository = Repository::Cvs.create(:root_url => REPOSITORY_PATH, - :url => MODULE_NAME) + @project = Project.find(PRJ_ID) + @repository = Repository::Cvs.create(:project => Project.find(PRJ_ID), + :root_url => REPOSITORY_PATH, + :url => MODULE_NAME) + assert @repository end if File.directory?(REPOSITORY_PATH) def test_show - get :show, :id => 1 + @repository.fetch_changesets + @repository.reload + get :show, :id => PRJ_ID assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -52,7 +57,9 @@ class RepositoriesCvsControllerTest < ActionController::TestCase end def test_browse_root - get :show, :id => 1 + @repository.fetch_changesets + @repository.reload + get :show, :id => PRJ_ID assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -66,7 +73,9 @@ class RepositoriesCvsControllerTest < ActionController::TestCase end def test_browse_directory - get :show, :id => 1, :path => ['images'] + @repository.fetch_changesets + @repository.reload + get :show, :id => PRJ_ID, :path => ['images'] assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -78,8 +87,9 @@ class RepositoriesCvsControllerTest < ActionController::TestCase end def test_browse_at_given_revision - Project.find(1).repository.fetch_changesets - get :show, :id => 1, :path => ['images'], :rev => 1 + @repository.fetch_changesets + @repository.reload + get :show, :id => PRJ_ID, :path => ['images'], :rev => 1 assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -87,7 +97,9 @@ class RepositoriesCvsControllerTest < ActionController::TestCase end def test_entry - get :entry, :id => 1, :path => ['sources', 'watchers_controller.rb'] + @repository.fetch_changesets + @repository.reload + get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'] assert_response :success assert_template 'entry' assert_no_tag :tag => 'td', :attributes => { :class => /line-code/}, @@ -96,8 +108,9 @@ class RepositoriesCvsControllerTest < ActionController::TestCase def test_entry_at_given_revision # changesets must be loaded - Project.find(1).repository.fetch_changesets - get :entry, :id => 1, :path => ['sources', 'watchers_controller.rb'], :rev => 2 + @repository.fetch_changesets + @repository.reload + get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :rev => 2 assert_response :success assert_template 'entry' # this line was removed in r3 @@ -106,18 +119,24 @@ class RepositoriesCvsControllerTest < ActionController::TestCase end def test_entry_not_found - get :entry, :id => 1, :path => ['sources', 'zzz.c'] + @repository.fetch_changesets + @repository.reload + get :entry, :id => PRJ_ID, :path => ['sources', 'zzz.c'] assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ }, :content => /The entry or revision was not found in the repository/ end def test_entry_download - get :entry, :id => 1, :path => ['sources', 'watchers_controller.rb'], :format => 'raw' + @repository.fetch_changesets + @repository.reload + get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :format => 'raw' assert_response :success end def test_directory_entry - get :entry, :id => 1, :path => ['sources'] + @repository.fetch_changesets + @repository.reload + get :entry, :id => PRJ_ID, :path => ['sources'] assert_response :success assert_template 'show' assert_not_nil assigns(:entry) @@ -125,8 +144,9 @@ class RepositoriesCvsControllerTest < ActionController::TestCase end def test_diff - Project.find(1).repository.fetch_changesets - get :diff, :id => 1, :rev => 3, :type => 'inline' + @repository.fetch_changesets + @repository.reload + get :diff, :id => PRJ_ID, :rev => 3, :type => 'inline' assert_response :success assert_template 'diff' assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_out' }, @@ -136,8 +156,9 @@ class RepositoriesCvsControllerTest < ActionController::TestCase end def test_annotate - Project.find(1).repository.fetch_changesets - get :annotate, :id => 1, :path => ['sources', 'watchers_controller.rb'] + @repository.fetch_changesets + @repository.reload + get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'] assert_response :success assert_template 'annotate' # 1.1 line -- 2.39.5