diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-14 16:38:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-14 16:38:57 +0300 |
commit | 10e18de60f55811137871acefd331d2d5a41f237 (patch) | |
tree | b227511752fb7021acec83fd3b2b5499434ae7f8 /spec/models | |
parent | 757327a59bcaecb986b0c07ae0cf09ed011e18ce (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-ee
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/application_setting_spec.rb | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 4b4e7820f7a..c13d83d1685 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -363,6 +363,85 @@ RSpec.describe ApplicationSetting do .is_less_than(65536) end + describe 'usage_ping_enabled setting' do + shared_examples 'usage ping enabled' do + it do + expect(setting.usage_ping_enabled).to eq(true) + expect(setting.usage_ping_enabled?).to eq(true) + end + end + + shared_examples 'usage ping disabled' do + it do + expect(setting.usage_ping_enabled).to eq(false) + expect(setting.usage_ping_enabled?).to eq(false) + end + end + + context 'when setting is in database' do + context 'with usage_ping_enabled disabled' do + before do + setting.update!(usage_ping_enabled: false) + end + + it_behaves_like 'usage ping disabled' + end + + context 'with usage_ping_enabled enabled' do + before do + setting.update!(usage_ping_enabled: true) + end + + it_behaves_like 'usage ping enabled' + end + end + + context 'when setting is in GitLab config' do + context 'with usage_ping_enabled disabled' do + before do + allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(false) + end + + it_behaves_like 'usage ping disabled' + end + + context 'with usage_ping_enabled enabled' do + before do + allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(true) + end + + it_behaves_like 'usage ping enabled' + end + end + + context 'when setting in database false and setting in GitLab config true' do + before do + setting.update!(usage_ping_enabled: false) + allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(true) + end + + it_behaves_like 'usage ping disabled' + end + + context 'when setting database true and setting in GitLab config false' do + before do + setting.update!(usage_ping_enabled: true) + allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(false) + end + + it_behaves_like 'usage ping disabled' + end + + context 'when setting database true and setting in GitLab config true' do + before do + setting.update!(usage_ping_enabled: true) + allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(true) + end + + it_behaves_like 'usage ping enabled' + end + end + context 'key restrictions' do it 'supports all key types' do expect(described_class::SUPPORTED_KEY_TYPES).to contain_exactly(:rsa, :dsa, :ecdsa, :ed25519) |