From e4f72a8e3afb6027954e594f4866a222630a6860 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 9 Jan 2011 09:53:50 +0000 Subject: [PATCH] scm: add compatible functional test fof changing diff revisions label at SCM adapter level. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4665 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../repositories_git_controller_test.rb | 27 ++++++++++++++++--- ...repositories_subversion_controller_test.rb | 4 +++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index da85da65c..f0c776082 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -33,9 +33,10 @@ class RepositoriesGitControllerTest < ActionController::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil - Repository::Git.create(:project => Project.find(3), :url => REPOSITORY_PATH) + @repository = Repository::Git.create(:project => Project.find(3), :url => REPOSITORY_PATH) + assert @repository end - + if File.directory?(REPOSITORY_PATH) def test_show get :show, :id => 3 @@ -126,8 +127,11 @@ class RepositoriesGitControllerTest < ActionController::TestCase assert_not_nil assigns(:entry) assert_equal 'sources', assigns(:entry).name end - + def test_diff + @repository.fetch_changesets + @repository.reload + # Full diff of changeset 2f9c0091 get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' assert_response :success @@ -138,6 +142,21 @@ class RepositoriesGitControllerTest < ActionController::TestCase :sibling => { :tag => 'td', :attributes => { :class => /diff_out/ }, :content => /def remove/ } + assert_tag :tag => 'h2', :content => /2f9c0091/ + end + + def test_diff_two_revs + @repository.fetch_changesets + @repository.reload + + get :diff, :id => 3, :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 @@ -150,7 +169,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase :sibling => { :tag => 'td', :content => /jsmith/ }, :sibling => { :tag => 'td', :content => /watcher =/ } end - + def test_annotate_binary_file get :annotate, :id => 3, :path => ['images', 'edit.png'] assert_response 500 diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index 5a554b9fc..32f0f78e7 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -198,6 +198,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase get :diff, :id => 1, :rev => 3 assert_response :success assert_template 'diff' + + assert_tag :tag => 'h2', :content => /3/ end def test_directory_diff @@ -209,6 +211,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_not_nil diff # 2 files modified assert_equal 2, Redmine::UnifiedDiff.new(diff).size + + assert_tag :tag => 'h2', :content => /2:6/ end def test_annotate -- 2.39.5