Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/gitaly_client/commit_service_spec.rb')
-rw-r--r--spec/lib/gitlab/gitaly_client/commit_service_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
index 8d9ab5db886..50a0f20e775 100644
--- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
@@ -563,4 +563,39 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
expect(response).not_to have_key 'nonexistent'
end
end
+
+ describe '#raw_blame' do
+ let(:project) { create(:project, :test_repo) }
+ let(:revision) { 'blame-on-renamed' }
+ let(:path) { 'files/plain_text/renamed' }
+
+ let(:blame_headers) do
+ [
+ '405a45736a75e439bb059e638afaa9a3c2eeda79 1 1 2',
+ '405a45736a75e439bb059e638afaa9a3c2eeda79 2 2',
+ 'bed1d1610ebab382830ee888288bf939c43873bb 3 3 1',
+ '3685515c40444faf92774e72835e1f9c0e809672 4 4 1',
+ '32c33da59f8a1a9f90bdeda570337888b00b244d 5 5 1'
+ ]
+ end
+
+ subject(:blame) { client.raw_blame(revision, path, range: range).split("\n") }
+
+ context 'without a range' do
+ let(:range) { nil }
+
+ it 'blames a whole file' do
+ is_expected.to include(*blame_headers)
+ end
+ end
+
+ context 'with a range' do
+ let(:range) { '3,4' }
+
+ it 'blames part of a file' do
+ is_expected.to include(blame_headers[2], blame_headers[3])
+ is_expected.not_to include(blame_headers[0], blame_headers[1], blame_headers[4])
+ end
+ end
+ end
end