diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/lib/gitlab/gitaly_client/commit_service_spec.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/lib/gitlab/gitaly_client/commit_service_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gitaly_client/commit_service_spec.rb | 35 |
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 |