# frozen_string_literal: true require 'spec_helper' RSpec.describe Admin::ApplicationSettingsController do include StubENV include UsageDataHelpers let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } let(:admin) { create(:admin) } let(:user) { create(:user)} before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') end describe 'GET #integrations' do before do sign_in(admin) end context 'when GitLab.com' do before do allow(::Gitlab).to receive(:com?) { true } end it 'returns 404' do get :integrations expect(response).to have_gitlab_http_status(:not_found) end end context 'when not GitLab.com' do before do allow(::Gitlab).to receive(:com?) { false } end it 'renders correct template' do get :integrations expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template('admin/application_settings/integrations') end end end describe 'GET #usage_data with no access' do before do stub_usage_data_connections sign_in(user) end it 'returns 404' do get :usage_data, format: :html expect(response).to have_gitlab_http_status(:not_found) end end describe 'GET #usage_data' do before do stub_usage_data_connections sign_in(admin) end it 'returns HTML data' do get :usage_data, format: :html expect(response.body).to start_with('