debian-mirror-gitlab/spec/controllers/admin/instance_review_controller_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.9 KiB
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-04-23 21:23:45 +05:30
RSpec.describe Admin::InstanceReviewController, feature_category: :service_ping do
2021-01-03 14:25:43 +05:30
include UsageDataHelpers
let(:admin) { create(:admin) }
2023-07-09 08:55:56 +05:30
let(:subscriptions_instance_review_url) { ::Gitlab::Routing.url_helpers.subscription_portal_instance_review_url }
2021-01-03 14:25:43 +05:30
before do
sign_in(admin)
end
context 'GET #index' do
let!(:group) { create(:group) }
let!(:projects) { create_list(:project, 2, group: group) }
subject { post :index }
context 'with usage ping enabled' do
before do
stub_application_setting(usage_ping_enabled: true)
stub_usage_data_connections
2022-03-02 08:16:31 +05:30
stub_database_flavor_check
2022-04-04 11:22:00 +05:30
::Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values)
2021-01-03 14:25:43 +05:30
subject
end
it 'redirects to the customers app with correct params' do
params = { instance_review: {
email: admin.email,
last_name: admin.name,
version: ::Gitlab::VERSION,
users_count: 5,
projects_count: 2,
groups_count: 1,
issues_count: 0,
merge_requests_count: 0,
internal_pipelines_count: 0,
external_pipelines_count: 0,
labels_count: 0,
milestones_count: 0,
snippets_count: 0,
notes_count: 0
} }.to_query
2021-11-18 22:05:49 +05:30
expect(response).to redirect_to("#{subscriptions_instance_review_url}?#{params}")
2021-01-03 14:25:43 +05:30
end
end
context 'with usage ping disabled' do
before do
stub_application_setting(usage_ping_enabled: false)
subject
end
it 'redirects to the customers app with correct params' do
params = { instance_review: {
email: admin.email,
last_name: admin.name,
version: ::Gitlab::VERSION
} }.to_query
2021-11-18 22:05:49 +05:30
expect(response).to redirect_to("#{subscriptions_instance_review_url}?#{params}")
2021-01-03 14:25:43 +05:30
end
end
end
end