summaryrefslogtreecommitdiffstats
path: root/test/integration/repositories_git_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 08:51:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 08:51:48 +0000
commit8daca338ed37bd1c26c6ad14d07208e1dc8c50d3 (patch)
tree4ec9caf3b518b592f879ded3a4683d7b83e9bec1 /test/integration/repositories_git_test.rb
parentb916bc809200dfc55b4b2de5b75e98cce3eb5876 (diff)
downloadredmine-8daca338ed37bd1c26c6ad14d07208e1dc8c50d3.tar.gz
redmine-8daca338ed37bd1c26c6ad14d07208e1dc8c50d3.zip
Unified diff link broken on specific file/revision diff view (#30850).
git-svn-id: http://svn.redmine.org/redmine/trunk@17962 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/repositories_git_test.rb')
-rw-r--r--test/integration/repositories_git_test.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/integration/repositories_git_test.rb b/test/integration/repositories_git_test.rb
index 8aa23c786..c241798f7 100644
--- a/test/integration/repositories_git_test.rb
+++ b/test/integration/repositories_git_test.rb
@@ -26,6 +26,7 @@ class RepositoriesGitTest < Redmine::IntegrationTest
REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
PRJ_ID = 3
+ NUM_REV = 28
def setup
User.current = nil
@@ -48,5 +49,37 @@ class RepositoriesGitTest < Redmine::IntegrationTest
get "/projects/subproject1/repository/#{@repository.id}/diff?rev=61b685fbe&rev_to=2f9c0091"
assert_response :success
end
+
+ def test_get_raw_diff_of_a_whole_revision
+ @repository.fetch_changesets
+ assert_equal NUM_REV, @repository.changesets.count
+
+ get "/projects/subproject1/repository/#{@repository.id}/revisions/deff712f05a90d96edbd70facc47d944be5897e3/diff"
+ assert_response :success
+
+ assert a = css_select("a.diff").first
+ assert_equal 'Unified diff', a.text
+ get a['href']
+ assert_response :success
+ assert_match /\Acommit deff712f05a90d96edbd70facc47d944be5897e3/, response.body
+ end
+
+ def test_get_raw_diff_of_a_single_file_change
+ @repository.fetch_changesets
+ assert_equal NUM_REV, @repository.changesets.count
+
+ get "/projects/subproject1/repository/#{@repository.id}/revisions/deff712f05a90d96edbd70facc47d944be5897e3/diff/sources/watchers_controller.rb"
+ assert_response :success
+
+ assert a = css_select("a.diff").first
+ assert_equal 'Unified diff', a.text
+ get a['href']
+ assert_response :success
+ assert_match /\Acommit deff712f05a90d96edbd70facc47d944be5897e3/, response.body
+ end
+
+ else
+ puts "Git test repository NOT FOUND. Skipping integration tests !!!"
+ def test_fake; assert true end
end
end