debian-mirror-gitlab/spec/requests/admin/integrations_controller_spec.rb

66 lines
1.8 KiB
Ruby
Raw Normal View History

2022-01-26 12:08:38 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe Admin::IntegrationsController, :enable_admin_mode, feature_category: :integrations do
2022-01-26 12:08:38 +05:30
let_it_be(:admin) { create(:admin) }
before do
sign_in(admin)
end
2023-07-09 08:55:56 +05:30
describe 'GET #edit' do
context 'when remove_monitor_metrics is true' do
before do
stub_feature_flags(remove_monitor_metrics: true)
end
it 'renders a 404 for the prometheus integration' do
get edit_admin_application_settings_integration_path(:prometheus)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
2022-01-26 12:08:38 +05:30
describe 'GET #overrides' do
let_it_be(:integration) { create(:jira_integration, :instance) }
let_it_be(:overridden_integration) { create(:jira_integration) }
let_it_be(:overridden_other_integration) { create(:confluence_integration) }
let(:overrides_path) { overrides_admin_application_settings_integration_path(integration, format: format) }
context 'format html' do
let(:format) { :html }
it 'renders' do
get overrides_path
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('shared/integrations/overrides')
end
end
context 'format json' do
let(:format) { :json }
let(:project) { overridden_integration.project }
it 'returns the project overrides data' do
get overrides_path
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to contain_exactly(
{
2022-08-27 11:52:29 +05:30
'id' => project.id,
2022-01-26 12:08:38 +05:30
'avatar_url' => project.avatar_url,
'full_name' => project.full_name,
'name' => project.name,
'full_path' => project_path(project)
}
)
end
end
end
end