From 02b43944e3b0fdf73d8877fd796b14a0a3c0dfaf Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 8 May 2011 01:48:53 +0000 Subject: [PATCH] scm: git: use constant value for project id in functional test. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5696 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../repositories_git_controller_test.rb | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index ca444b683..a87d88833 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -27,6 +27,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase # No '..' in the repository path REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository' REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? + PRJ_ID = 3 def setup @controller = RepositoriesController.new @@ -45,7 +46,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase def test_browse_root @repository.fetch_changesets @repository.reload - get :show, :id => 3 + get :show, :id => PRJ_ID assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -66,7 +67,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase def test_browse_branch @repository.fetch_changesets @repository.reload - get :show, :id => 3, :rev => 'test_branch' + get :show, :id => PRJ_ID, :rev => 'test_branch' assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -86,7 +87,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase "tag00.lightweight", "tag01.annotated", ].each do |t1| - get :show, :id => 3, :rev => t1 + get :show, :id => PRJ_ID, :rev => t1 assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -99,7 +100,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase def test_browse_directory @repository.fetch_changesets @repository.reload - get :show, :id => 3, :path => ['images'] + get :show, :id => PRJ_ID, :path => ['images'] assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -115,7 +116,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase def test_browse_at_given_revision @repository.fetch_changesets @repository.reload - get :show, :id => 3, :path => ['images'], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518' + get :show, :id => PRJ_ID, :path => ['images'], + :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518' assert_response :success assert_template 'show' assert_not_nil assigns(:entries) @@ -125,14 +127,14 @@ class RepositoriesGitControllerTest < ActionController::TestCase end def test_changes - get :changes, :id => 3, :path => ['images', 'edit.png'] + get :changes, :id => PRJ_ID, :path => ['images', 'edit.png'] assert_response :success assert_template 'changes' assert_tag :tag => 'h2', :content => 'edit.png' end def test_entry_show - get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'] + get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'] assert_response :success assert_template 'entry' # Line 19 @@ -143,14 +145,15 @@ class RepositoriesGitControllerTest < ActionController::TestCase end def test_entry_download - get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw' + get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], + :format => 'raw' assert_response :success # File content assert @response.body.include?('WITHOUT ANY WARRANTY') end def test_directory_entry - get :entry, :id => 3, :path => ['sources'] + get :entry, :id => PRJ_ID, :path => ['sources'] assert_response :success assert_template 'show' assert_not_nil assigns(:entry) @@ -160,9 +163,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase def test_diff @repository.fetch_changesets @repository.reload - # Full diff of changeset 2f9c0091 - get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' + get :diff, :id => PRJ_ID, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' assert_response :success assert_template 'diff' # Line 22 removed @@ -177,19 +179,18 @@ class RepositoriesGitControllerTest < ActionController::TestCase def test_diff_two_revs @repository.fetch_changesets @repository.reload - - get :diff, :id => 3, :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', - :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' + get :diff, :id => PRJ_ID, + :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', + :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' assert_response :success assert_template 'diff' - diff = assigns(:diff) assert_not_nil diff assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/ end def test_annotate - get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb'] + get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'] assert_response :success assert_template 'annotate' # Line 23, changeset 2f9c0091 @@ -216,14 +217,15 @@ class RepositoriesGitControllerTest < ActionController::TestCase def test_annotate_at_given_revision @repository.fetch_changesets @repository.reload - get :annotate, :id => 3, :rev => 'deff7', :path => ['sources', 'watchers_controller.rb'] + get :annotate, :id => PRJ_ID, :rev => 'deff7', + :path => ['sources', 'watchers_controller.rb'] assert_response :success assert_template 'annotate' assert_tag :tag => 'h2', :content => /@ deff712f/ end def test_annotate_binary_file - get :annotate, :id => 3, :path => ['images', 'edit.png'] + get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png'] assert_response 500 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ }, :content => /cannot be annotated/ @@ -233,7 +235,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase @repository.fetch_changesets @repository.reload ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r| - get :revision, :id => 3, :rev => r + get :revision, :id => PRJ_ID, :rev => r assert_response :success assert_template 'revision' end @@ -243,7 +245,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase @repository.fetch_changesets @repository.reload ['', ' ', nil].each do |r| - get :revision, :id => 3, :rev => r + get :revision, :id => PRJ_ID, :rev => r assert_response 404 assert_error_tag :content => /was not found/ end -- 2.39.5