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/support/shared_examples/services')
-rw-r--r--spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb26
-rw-r--r--spec/support/shared_examples/services/jira/requests/base_shared_examples.rb16
2 files changed, 24 insertions, 18 deletions
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
diff --git a/spec/support/shared_examples/services/jira/requests/base_shared_examples.rb b/spec/support/shared_examples/services/jira/requests/base_shared_examples.rb
index c4f6273b46c..5e49bdd706c 100644
--- a/spec/support/shared_examples/services/jira/requests/base_shared_examples.rb
+++ b/spec/support/shared_examples/services/jira/requests/base_shared_examples.rb
@@ -66,18 +66,12 @@ RSpec.shared_examples 'a service that handles Jira API errors' do
it 'logs the error' do
stub_client_and_raise(Timeout::Error, 'foo')
- expect(Gitlab::ProjectServiceLogger).to receive(:error).with(
- hash_including(
- client_url: be_present,
- message: 'Error sending message',
- service_class: described_class.name,
- error: hash_including(
- exception_class: Timeout::Error.name,
- exception_message: 'foo',
- exception_backtrace: be_present
- )
- )
+ expect(jira_integration).to receive(:log_exception).with(
+ kind_of(Timeout::Error),
+ message: 'Error sending message',
+ client_url: jira_integration.url
)
+
expect(subject).to be_error
end