diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/controllers/admin/integrations_controller_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/controllers/admin/integrations_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin/integrations_controller_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/admin/integrations_controller_spec.rb b/spec/controllers/admin/integrations_controller_spec.rb index 1a13d016b73..e14619a9916 100644 --- a/spec/controllers/admin/integrations_controller_spec.rb +++ b/spec/controllers/admin/integrations_controller_spec.rb @@ -73,4 +73,28 @@ RSpec.describe Admin::IntegrationsController do end end end + + describe '#reset' do + let_it_be(:integration) { create(:jira_service, :instance) } + let_it_be(:inheriting_integration) { create(:jira_service, inherit_from_id: integration.id) } + + subject do + post :reset, params: { id: integration.class.to_param } + end + + it 'returns 200 OK', :aggregate_failures do + subject + + expected_json = {}.to_json + + expect(flash[:notice]).to eq('This integration, and inheriting projects were reset.') + expect(response).to have_gitlab_http_status(:ok) + expect(response.body).to eq(expected_json) + end + + it 'deletes the integration and all inheriting integrations' do + expect { subject }.to change { JiraService.for_instance.count }.by(-1) + .and change { JiraService.inherit_from_id(integration.id).count }.by(-1) + end + end end |