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:
Diffstat (limited to 'spec/workers/git_garbage_collect_worker_spec.rb')
-rw-r--r--spec/workers/git_garbage_collect_worker_spec.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/spec/workers/git_garbage_collect_worker_spec.rb b/spec/workers/git_garbage_collect_worker_spec.rb
index 223f5aea813..1be6e86b650 100644
--- a/spec/workers/git_garbage_collect_worker_spec.rb
+++ b/spec/workers/git_garbage_collect_worker_spec.rb
@@ -25,12 +25,18 @@ RSpec.describe GitGarbageCollectWorker do
end
shared_examples 'it updates the project statistics' do
- specify do
- expect_any_instance_of(Projects::UpdateStatisticsService).to receive(:execute).and_call_original
- expect(Projects::UpdateStatisticsService)
- .to receive(:new)
- .with(project, nil, statistics: [:repository_size, :lfs_objects_size])
- .and_call_original
+ it 'updates the project statistics' do
+ expect_next_instance_of(Projects::UpdateStatisticsService, project, nil, statistics: [:repository_size, :lfs_objects_size]) do |service|
+ expect(service).to receive(:execute).and_call_original
+ end
+
+ subject.perform(*params)
+ end
+
+ it 'does nothing if the database is read-only' do
+ allow(Gitlab::Database).to receive(:read_only?) { true }
+
+ expect_any_instance_of(Projects::UpdateStatisticsService).not_to receive(:execute)
subject.perform(*params)
end
@@ -141,7 +147,8 @@ RSpec.describe GitGarbageCollectWorker do
end
it 'does nothing if the database is read-only' do
- expect(Gitlab::Database).to receive(:read_only?) { true }
+ allow(Gitlab::Database).to receive(:read_only?) { true }
+
expect_any_instance_of(Gitlab::Cleanup::OrphanLfsFileReferences).not_to receive(:run!)
subject.perform(*params)