diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 12:06:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 12:06:31 +0300 |
commit | 6b13a226ddfc49140d58e7e88f8703ae0ed90574 (patch) | |
tree | 9a92431e484354f43230fa87adc00a2edbf6f09c /spec/services/projects | |
parent | 2ac93cb80c4c0a57fde86de8262b569d1e9b9e51 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/git_deduplication_service_spec.rb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/services/projects/git_deduplication_service_spec.rb b/spec/services/projects/git_deduplication_service_spec.rb index 3acbc46b473..9e6279da7de 100644 --- a/spec/services/projects/git_deduplication_service_spec.rb +++ b/spec/services/projects/git_deduplication_service_spec.rb @@ -58,6 +58,65 @@ describe Projects::GitDeduplicationService do service.execute end + + context 'when visibility level of the project' do + before do + allow(pool.source_project).to receive(:repository_access_level).and_return(ProjectFeature::ENABLED) + end + + context 'is private' do + it 'does not call fetch' do + allow(pool.source_project).to receive(:visibility_level).and_return(Gitlab::VisibilityLevel::PRIVATE) + expect(pool.object_pool).not_to receive(:fetch) + + service.execute + end + end + + context 'is public' do + it 'calls fetch' do + allow(pool.source_project).to receive(:visibility_level).and_return(Gitlab::VisibilityLevel::PUBLIC) + expect(pool.object_pool).to receive(:fetch) + + service.execute + end + end + + context 'is internal' do + it 'calls fetch' do + allow(pool.source_project).to receive(:visibility_level).and_return(Gitlab::VisibilityLevel::INTERNAL) + expect(pool.object_pool).to receive(:fetch) + + service.execute + end + end + end + + context 'when the repository access level' do + before do + allow(pool.source_project).to receive(:visibility_level).and_return(Gitlab::VisibilityLevel::PUBLIC) + end + + context 'is private' do + it 'does not call fetch' do + allow(pool.source_project).to receive(:repository_access_level).and_return(ProjectFeature::PRIVATE) + + expect(pool.object_pool).not_to receive(:fetch) + + service.execute + end + end + + context 'is greater than private' do + it 'calls fetch' do + allow(pool.source_project).to receive(:repository_access_level).and_return(ProjectFeature::PUBLIC) + + expect(pool.object_pool).to receive(:fetch) + + service.execute + end + end + end end it 'links the repository to the object pool' do |