diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 15:09:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 15:09:13 +0300 |
commit | 211a8c3361ccf4eb92f36edbdcf15c98fcdcc8b7 (patch) | |
tree | 0ad37172721a39b0d57240bb1b4e70f200a0d93e /spec/workers/repository_fork_worker_spec.rb | |
parent | 456a7247f9e88fc2518b69a1a00e905c6db6d775 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/repository_fork_worker_spec.rb')
-rw-r--r-- | spec/workers/repository_fork_worker_spec.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index 26fd67adfaa..01104049404 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -72,13 +72,33 @@ describe RepositoryForkWorker do perform! end - it "handles bad fork" do - error_message = "Unable to fork project #{forked_project.id} for repository #{project.disk_path} -> #{forked_project.disk_path}" + it 'handles bad fork' do + error_message = "Unable to fork project #{forked_project.id} for repository #{project.disk_path} -> #{forked_project.disk_path}: Failed to create fork repository" expect_fork_repository.and_return(false) expect { perform! }.to raise_error(StandardError, error_message) end + + it 'calls Projects::LfsPointers::LfsLinkService#execute with OIDs of source project LFS objects' do + expect_fork_repository.and_return(true) + expect_next_instance_of(Projects::LfsPointers::LfsLinkService) do |service| + expect(service).to receive(:execute).with(project.lfs_objects_oids) + end + + perform! + end + + it "handles LFS objects link failure" do + error_message = "Unable to fork project #{forked_project.id} for repository #{project.disk_path} -> #{forked_project.disk_path}: Source project has too many LFS objects" + + expect_fork_repository.and_return(true) + expect_next_instance_of(Projects::LfsPointers::LfsLinkService) do |service| + expect(service).to receive(:execute).and_raise(Projects::LfsPointers::LfsLinkService::TooManyOidsError) + end + + expect { perform! }.to raise_error(StandardError, error_message) + end end context 'only project ID passed' do |