diff options
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 |