summaryrefslogtreecommitdiff
path: root/spec/workers/repository_import_worker_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-17 21:08:29 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-17 21:08:29 +0000
commit40254b9ace2a74a3c9f1cc51a1b1d5e3e78c1ae9 (patch)
tree9b735ef933178be36d35088f3acab2d9b75dbbad /spec/workers/repository_import_worker_spec.rb
parent22a0d312ae82e7dda3073d5d1a5a766d7641738d (diff)
downloadgitlab-ce-40254b9ace2a74a3c9f1cc51a1b1d5e3e78c1ae9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/repository_import_worker_spec.rb')
-rw-r--r--spec/workers/repository_import_worker_spec.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/spec/workers/repository_import_worker_spec.rb b/spec/workers/repository_import_worker_spec.rb
index b8767af8eee..507098582c9 100644
--- a/spec/workers/repository_import_worker_spec.rb
+++ b/spec/workers/repository_import_worker_spec.rb
@@ -21,8 +21,9 @@ describe RepositoryImportWorker do
allow(subject).to receive(:jid).and_return(jid)
- expect_any_instance_of(Projects::ImportService).to receive(:execute)
- .and_return({ status: :ok })
+ expect_next_instance_of(Projects::ImportService) do |instance|
+ expect(instance).to receive(:execute).and_return({ status: :ok })
+ end
# Works around https://github.com/rspec/rspec-mocks/issues/910
expect(Project).to receive(:find).with(started_project.id).and_return(started_project)
@@ -36,8 +37,9 @@ describe RepositoryImportWorker do
context 'when the import was successful' do
it 'imports a project' do
- expect_any_instance_of(Projects::ImportService).to receive(:execute)
- .and_return({ status: :ok })
+ expect_next_instance_of(Projects::ImportService) do |instance|
+ expect(instance).to receive(:execute).and_return({ status: :ok })
+ end
# Works around https://github.com/rspec/rspec-mocks/issues/910
expect(Project).to receive(:find).with(project.id).and_return(project)
@@ -54,7 +56,9 @@ describe RepositoryImportWorker do
error = %q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
import_state.update(jid: '123')
- expect_any_instance_of(Projects::ImportService).to receive(:execute).and_return({ status: :error, message: error })
+ expect_next_instance_of(Projects::ImportService) do |instance|
+ expect(instance).to receive(:execute).and_return({ status: :error, message: error })
+ end
expect do
subject.perform(project.id)
@@ -67,7 +71,9 @@ describe RepositoryImportWorker do
project.update(import_type: 'gitlab_project')
import_state.update(jid: '123')
- expect_any_instance_of(Projects::ImportService).to receive(:execute).and_return({ status: :error, message: error })
+ expect_next_instance_of(Projects::ImportService) do |instance|
+ expect(instance).to receive(:execute).and_return({ status: :error, message: error })
+ end
expect do
subject.perform(project.id)
@@ -93,8 +99,9 @@ describe RepositoryImportWorker do
.to receive(:async?)
.and_return(true)
- expect_any_instance_of(ProjectImportState)
- .not_to receive(:finish)
+ expect_next_instance_of(ProjectImportState) do |instance|
+ expect(instance).not_to receive(:finish)
+ end
subject.perform(project.id)
end