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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-18 00:08:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-18 00:08:29 +0300
commit40254b9ace2a74a3c9f1cc51a1b1d5e3e78c1ae9 (patch)
tree9b735ef933178be36d35088f3acab2d9b75dbbad /spec/workers
parent22a0d312ae82e7dda3073d5d1a5a766d7641738d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/ci/archive_traces_cron_worker_spec.rb9
-rw-r--r--spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb6
-rw-r--r--spec/workers/delete_merged_branches_worker_spec.rb4
-rw-r--r--spec/workers/expire_build_artifacts_worker_spec.rb4
-rw-r--r--spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb12
-rw-r--r--spec/workers/gitlab_shell_worker_spec.rb4
-rw-r--r--spec/workers/gitlab_usage_ping_worker_spec.rb4
-rw-r--r--spec/workers/hashed_storage/migrator_worker_spec.rb4
-rw-r--r--spec/workers/hashed_storage/rollbacker_worker_spec.rb4
-rw-r--r--spec/workers/import_issues_csv_worker_spec.rb4
-rw-r--r--spec/workers/new_release_worker_spec.rb4
-rw-r--r--spec/workers/repository_import_worker_spec.rb23
12 files changed, 54 insertions, 28 deletions
diff --git a/spec/workers/ci/archive_traces_cron_worker_spec.rb b/spec/workers/ci/archive_traces_cron_worker_spec.rb
index fc700c15b10..789e83783bb 100644
--- a/spec/workers/ci/archive_traces_cron_worker_spec.rb
+++ b/spec/workers/ci/archive_traces_cron_worker_spec.rb
@@ -35,8 +35,9 @@ describe Ci::ArchiveTracesCronWorker do
it_behaves_like 'archives trace'
it 'executes service' do
- expect_any_instance_of(Ci::ArchiveTraceService)
- .to receive(:execute).with(build, anything)
+ expect_next_instance_of(Ci::ArchiveTraceService) do |instance|
+ expect(instance).to receive(:execute).with(build, anything)
+ end
subject
end
@@ -64,7 +65,9 @@ describe Ci::ArchiveTracesCronWorker do
before do
allow(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception)
- allow_any_instance_of(Gitlab::Ci::Trace).to receive(:archive!).and_raise('Unexpected error')
+ allow_next_instance_of(Gitlab::Ci::Trace) do |instance|
+ allow(instance).to receive(:archive!).and_raise('Unexpected error')
+ end
end
it 'puts a log' do
diff --git a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
index 294eacf09ab..c4f6ddf9aca 100644
--- a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
+++ b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
@@ -57,9 +57,9 @@ describe Gitlab::GithubImport::ReschedulingMethods do
expect(worker)
.not_to receive(:notify_waiter)
- expect_any_instance_of(Gitlab::GithubImport::Client)
- .to receive(:rate_limit_resets_in)
- .and_return(14)
+ expect_next_instance_of(Gitlab::GithubImport::Client) do |instance|
+ expect(instance).to receive(:rate_limit_resets_in).and_return(14)
+ end
expect(worker.class)
.to receive(:perform_in)
diff --git a/spec/workers/delete_merged_branches_worker_spec.rb b/spec/workers/delete_merged_branches_worker_spec.rb
index 8c983859e36..3eaeb7e0797 100644
--- a/spec/workers/delete_merged_branches_worker_spec.rb
+++ b/spec/workers/delete_merged_branches_worker_spec.rb
@@ -9,7 +9,9 @@ describe DeleteMergedBranchesWorker do
describe "#perform" do
it "delegates to Branches::DeleteMergedService" do
- expect_any_instance_of(::Branches::DeleteMergedService).to receive(:execute).and_return(true)
+ expect_next_instance_of(::Branches::DeleteMergedService) do |instance|
+ expect(instance).to receive(:execute).and_return(true)
+ end
worker.perform(project.id, project.owner.id)
end
diff --git a/spec/workers/expire_build_artifacts_worker_spec.rb b/spec/workers/expire_build_artifacts_worker_spec.rb
index 0a0aea838d2..06561e94fb7 100644
--- a/spec/workers/expire_build_artifacts_worker_spec.rb
+++ b/spec/workers/expire_build_artifacts_worker_spec.rb
@@ -7,7 +7,9 @@ describe ExpireBuildArtifactsWorker do
describe '#perform' do
it 'executes a service' do
- expect_any_instance_of(Ci::DestroyExpiredJobArtifactsService).to receive(:execute)
+ expect_next_instance_of(Ci::DestroyExpiredJobArtifactsService) do |instance|
+ expect(instance).to receive(:execute)
+ end
worker.perform
end
diff --git a/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb
index 6d47d73b92e..3a8fe73622a 100644
--- a/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb
@@ -21,9 +21,9 @@ describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do
it 'schedules the importing of the base data' do
client = double(:client)
- expect_any_instance_of(Gitlab::GithubImport::Importer::RepositoryImporter)
- .to receive(:execute)
- .and_return(true)
+ expect_next_instance_of(Gitlab::GithubImport::Importer::RepositoryImporter) do |instance|
+ expect(instance).to receive(:execute).and_return(true)
+ end
expect(Gitlab::GithubImport::Stage::ImportBaseDataWorker)
.to receive(:perform_async)
@@ -37,9 +37,9 @@ describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do
it 'does not schedule the importing of the base data' do
client = double(:client)
- expect_any_instance_of(Gitlab::GithubImport::Importer::RepositoryImporter)
- .to receive(:execute)
- .and_return(false)
+ expect_next_instance_of(Gitlab::GithubImport::Importer::RepositoryImporter) do |instance|
+ expect(instance).to receive(:execute).and_return(false)
+ end
expect(Gitlab::GithubImport::Stage::ImportBaseDataWorker)
.not_to receive(:perform_async)
diff --git a/spec/workers/gitlab_shell_worker_spec.rb b/spec/workers/gitlab_shell_worker_spec.rb
index 0758cfc4ee2..5dedf5be9fa 100644
--- a/spec/workers/gitlab_shell_worker_spec.rb
+++ b/spec/workers/gitlab_shell_worker_spec.rb
@@ -7,7 +7,9 @@ describe GitlabShellWorker do
describe '#perform with add_key' do
it 'calls add_key on Gitlab::Shell' do
- expect_any_instance_of(Gitlab::Shell).to receive(:add_key).with('foo', 'bar')
+ expect_next_instance_of(Gitlab::Shell) do |instance|
+ expect(instance).to receive(:add_key).with('foo', 'bar')
+ end
worker.perform(:add_key, 'foo', 'bar')
end
end
diff --git a/spec/workers/gitlab_usage_ping_worker_spec.rb b/spec/workers/gitlab_usage_ping_worker_spec.rb
index aff5d112cdd..198daf40493 100644
--- a/spec/workers/gitlab_usage_ping_worker_spec.rb
+++ b/spec/workers/gitlab_usage_ping_worker_spec.rb
@@ -8,7 +8,9 @@ describe GitlabUsagePingWorker do
it 'delegates to SubmitUsagePingService' do
allow(subject).to receive(:try_obtain_lease).and_return(true)
- expect_any_instance_of(SubmitUsagePingService).to receive(:execute)
+ expect_next_instance_of(SubmitUsagePingService) do |instance|
+ expect(instance).to receive(:execute)
+ end
subject.perform
end
diff --git a/spec/workers/hashed_storage/migrator_worker_spec.rb b/spec/workers/hashed_storage/migrator_worker_spec.rb
index 9180da87058..ac76a306f43 100644
--- a/spec/workers/hashed_storage/migrator_worker_spec.rb
+++ b/spec/workers/hashed_storage/migrator_worker_spec.rb
@@ -10,7 +10,9 @@ describe HashedStorage::MigratorWorker do
describe '#perform' do
it 'delegates to MigratorService' do
- expect_any_instance_of(Gitlab::HashedStorage::Migrator).to receive(:bulk_migrate).with(start: 5, finish: 10)
+ expect_next_instance_of(Gitlab::HashedStorage::Migrator) do |instance|
+ expect(instance).to receive(:bulk_migrate).with(start: 5, finish: 10)
+ end
worker.perform(5, 10)
end
diff --git a/spec/workers/hashed_storage/rollbacker_worker_spec.rb b/spec/workers/hashed_storage/rollbacker_worker_spec.rb
index 3ca2601df0f..55fc4fb0fe1 100644
--- a/spec/workers/hashed_storage/rollbacker_worker_spec.rb
+++ b/spec/workers/hashed_storage/rollbacker_worker_spec.rb
@@ -10,7 +10,9 @@ describe HashedStorage::RollbackerWorker do
describe '#perform' do
it 'delegates to MigratorService' do
- expect_any_instance_of(Gitlab::HashedStorage::Migrator).to receive(:bulk_rollback).with(start: 5, finish: 10)
+ expect_next_instance_of(Gitlab::HashedStorage::Migrator) do |instance|
+ expect(instance).to receive(:bulk_rollback).with(start: 5, finish: 10)
+ end
worker.perform(5, 10)
end
diff --git a/spec/workers/import_issues_csv_worker_spec.rb b/spec/workers/import_issues_csv_worker_spec.rb
index 89370c4890d..03944cfb05d 100644
--- a/spec/workers/import_issues_csv_worker_spec.rb
+++ b/spec/workers/import_issues_csv_worker_spec.rb
@@ -11,7 +11,9 @@ describe ImportIssuesCsvWorker do
describe '#perform' do
it 'calls #execute on Issues::ImportCsvService and destroys upload' do
- expect_any_instance_of(Issues::ImportCsvService).to receive(:execute).and_return({ success: 5, errors: [], valid_file: true })
+ expect_next_instance_of(Issues::ImportCsvService) do |instance|
+ expect(instance).to receive(:execute).and_return({ success: 5, errors: [], valid_file: true })
+ end
worker.perform(user.id, project.id, upload.id)
diff --git a/spec/workers/new_release_worker_spec.rb b/spec/workers/new_release_worker_spec.rb
index 9010c36f795..9d8c5bbf919 100644
--- a/spec/workers/new_release_worker_spec.rb
+++ b/spec/workers/new_release_worker_spec.rb
@@ -6,7 +6,9 @@ describe NewReleaseWorker do
let(:release) { create(:release) }
it 'sends a new release notification' do
- expect_any_instance_of(NotificationService).to receive(:send_new_release_notifications).with(release)
+ expect_next_instance_of(NotificationService) do |instance|
+ expect(instance).to receive(:send_new_release_notifications).with(release)
+ end
described_class.new.perform(release.id)
end
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