diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/services/jira_connect_installations | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/services/jira_connect_installations')
-rw-r--r-- | spec/services/jira_connect_installations/update_service_spec.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/services/jira_connect_installations/update_service_spec.rb b/spec/services/jira_connect_installations/update_service_spec.rb index ec5bb5d6d6a..15f3b485b20 100644 --- a/spec/services/jira_connect_installations/update_service_spec.rb +++ b/spec/services/jira_connect_installations/update_service_spec.rb @@ -45,8 +45,9 @@ RSpec.describe JiraConnectInstallations::UpdateService, feature_category: :integ let_it_be_with_reload(:installation) { create(:jira_connect_installation, instance_url: 'https://other_gitlab.example.com') } it 'sends an installed event to the instance', :aggregate_failures do - expect_next_instance_of(JiraConnectInstallations::ProxyLifecycleEventService, installation, :installed, -'https://other_gitlab.example.com') do |proxy_lifecycle_events_service| + expect_next_instance_of( + JiraConnectInstallations::ProxyLifecycleEventService, installation, :installed, 'https://other_gitlab.example.com' + ) do |proxy_lifecycle_events_service| expect(proxy_lifecycle_events_service).to receive(:execute).and_return(ServiceResponse.new(status: :success)) end @@ -62,19 +63,19 @@ RSpec.describe JiraConnectInstallations::UpdateService, feature_category: :integ stub_request(:post, 'https://other_gitlab.example.com/-/jira_connect/events/uninstalled') end - it 'starts an async worker to send an uninstalled event to the previous instance' do - expect(JiraConnect::SendUninstalledHookWorker).to receive(:perform_async).with(installation.id, 'https://other_gitlab.example.com') - + it 'sends an installed event to the instance and updates instance_url' do expect(JiraConnectInstallations::ProxyLifecycleEventService) .to receive(:execute).with(installation, :installed, 'https://gitlab.example.com') .and_return(ServiceResponse.new(status: :success)) + expect(JiraConnect::SendUninstalledHookWorker).not_to receive(:perform_async) + execute_service expect(installation.instance_url).to eq(update_params[:instance_url]) end - context 'and the new instance_url is empty' do + context 'and the new instance_url is nil' do let(:update_params) { { instance_url: nil } } it 'starts an async worker to send an uninstalled event to the previous instance' do @@ -98,8 +99,9 @@ RSpec.describe JiraConnectInstallations::UpdateService, feature_category: :integ let(:update_params) { { instance_url: 'https://gitlab.example.com' } } it 'sends an installed event to the instance and updates instance_url' do - expect_next_instance_of(JiraConnectInstallations::ProxyLifecycleEventService, installation, :installed, -'https://gitlab.example.com') do |proxy_lifecycle_events_service| + expect_next_instance_of( + JiraConnectInstallations::ProxyLifecycleEventService, installation, :installed, 'https://gitlab.example.com' + ) do |proxy_lifecycle_events_service| expect(proxy_lifecycle_events_service).to receive(:execute).and_return(ServiceResponse.new(status: :success)) end |