debian-mirror-gitlab/spec/views/admin/application_settings/general.html.haml_spec.rb

64 lines
1.7 KiB
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe 'admin/application_settings/general.html.haml' do
2020-04-22 19:07:51 +05:30
let(:app_settings) { build(:application_setting) }
let(:user) { create(:admin) }
describe 'sourcegraph integration' do
let(:sourcegraph_flag) { true }
before do
assign(:application_setting, app_settings)
allow(Gitlab::Sourcegraph).to receive(:feature_available?).and_return(sourcegraph_flag)
allow(view).to receive(:current_user).and_return(user)
end
context 'when sourcegraph feature is enabled' do
it 'show the form' do
render
expect(rendered).to have_field('application_setting_sourcegraph_enabled')
end
end
context 'when sourcegraph feature is disabled' do
let(:sourcegraph_flag) { false }
it 'show the form' do
render
expect(rendered).not_to have_field('application_setting_sourcegraph_enabled')
end
end
end
2022-04-04 11:22:00 +05:30
describe 'prompt user about registration features' do
before do
assign(:application_setting, app_settings)
allow(view).to receive(:current_user).and_return(user)
end
context 'when service ping is enabled' do
before do
stub_application_setting(usage_ping_enabled: true)
end
it_behaves_like 'does not render registration features prompt', :application_setting_disabled_repository_size_limit
end
context 'with no license and service ping disabled' do
before do
stub_application_setting(usage_ping_enabled: false)
if Gitlab.ee?
allow(License).to receive(:current).and_return(nil)
end
end
it_behaves_like 'renders registration features prompt', :application_setting_disabled_repository_size_limit
end
end
2020-04-22 19:07:51 +05:30
end