diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/support/shared_examples/services | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/support/shared_examples/services')
-rw-r--r-- | spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb | 26 | ||||
-rw-r--r-- | spec/support/shared_examples/services/jira/requests/base_shared_examples.rb | 16 |
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 |