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>2022-04-21 12:10:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-21 12:10:19 +0300
commitb32f4c7a2810afb602c33d904c51bdb178d146b4 (patch)
tree877178b9e38df6ea33d554cca87017eb1e7db284 /spec/support
parentd11791c814954de77f85be1c2f7b56168532c96d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/database/query_analyzer.rb8
-rw-r--r--spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb26
2 files changed, 25 insertions, 9 deletions
diff --git a/spec/support/database/query_analyzer.rb b/spec/support/database/query_analyzer.rb
index 6d6627d54b9..aaa1b3516a3 100644
--- a/spec/support/database/query_analyzer.rb
+++ b/spec/support/database/query_analyzer.rb
@@ -6,13 +6,17 @@
RSpec.configure do |config|
config.before do |example|
if example.metadata.fetch(:query_analyzers, true)
- ::Gitlab::Database::QueryAnalyzer.instance.begin!
+ ::Gitlab::Database::QueryAnalyzer.instance.begin!(
+ ::Gitlab::Database::QueryAnalyzer.instance.all_analyzers
+ )
end
end
config.after do |example|
if example.metadata.fetch(:query_analyzers, true)
- ::Gitlab::Database::QueryAnalyzer.instance.end!
+ ::Gitlab::Database::QueryAnalyzer.instance.end!(
+ ::Gitlab::Database::QueryAnalyzer.instance.all_analyzers
+ )
end
end
end
diff --git a/spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb b/spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb
index e776c098fa0..31571b1ffb9 100644
--- a/spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb
+++ b/spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb
@@ -1,21 +1,33 @@
# frozen_string_literal: true
-shared_examples_for 'service deleting todos' do
+shared_examples_for 'service scheduling async deletes' do
it 'destroys associated todos asynchronously' do
- expect(TodosDestroyer::DestroyedIssuableWorker)
+ expect(worker_class)
.to receive(:perform_async)
.with(issuable.id, issuable.class.name)
subject.execute(issuable)
end
-end
-shared_examples_for 'service deleting label links' do
- it 'destroys associated label links asynchronously' do
- expect(Issuable::LabelLinksDestroyWorker)
+ it 'works inside a transaction' do
+ expect(worker_class)
.to receive(:perform_async)
.with(issuable.id, issuable.class.name)
- subject.execute(issuable)
+ ApplicationRecord.transaction do
+ subject.execute(issuable)
+ end
+ end
+end
+
+shared_examples_for 'service deleting todos' do
+ it_behaves_like 'service scheduling async deletes' do
+ let(:worker_class) { TodosDestroyer::DestroyedIssuableWorker }
+ end
+end
+
+shared_examples_for 'service deleting label links' do
+ it_behaves_like 'service scheduling async deletes' do
+ let(:worker_class) { Issuable::LabelLinksDestroyWorker }
end
end