diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/throttle_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/throttle_spec.rb')
-rw-r--r-- | spec/lib/gitlab/throttle_spec.rb | 78 |
1 files changed, 3 insertions, 75 deletions
diff --git a/spec/lib/gitlab/throttle_spec.rb b/spec/lib/gitlab/throttle_spec.rb index 674646a5f06..e3679a1a721 100644 --- a/spec/lib/gitlab/throttle_spec.rb +++ b/spec/lib/gitlab/throttle_spec.rb @@ -6,82 +6,10 @@ describe Gitlab::Throttle do describe '.protected_paths_enabled?' do subject { described_class.protected_paths_enabled? } - context 'when omnibus protected paths throttle should be used' do - before do - expect(described_class).to receive(:should_use_omnibus_protected_paths?).and_return(true) - end + it 'returns Application Settings throttle_protected_paths_enabled?' do + expect(Gitlab::CurrentSettings.current_application_settings).to receive(:throttle_protected_paths_enabled?) - it { is_expected.to be_falsey } - end - - context 'when omnibus protected paths throttle should not be used' do - before do - expect(described_class).to receive(:should_use_omnibus_protected_paths?).and_return(false) - end - - it 'returns Application Settings throttle_protected_paths_enabled?' do - expect(Gitlab::CurrentSettings.current_application_settings).to receive(:throttle_protected_paths_enabled?) - - subject - end - end - end - - describe '.should_use_omnibus_protected_paths?' do - subject { described_class.should_use_omnibus_protected_paths? } - - context 'when rack_attack.admin_area_protected_paths_enabled config is unspecified' do - context 'when the omnibus protected paths throttle has been recently used (it has data)' do - before do - expect(described_class).to receive(:omnibus_protected_paths_present?).and_return(true) - end - - it { is_expected.to be_truthy } - end - - context 'when the omnibus protected paths throttle has not been recently used' do - before do - expect(described_class).to receive(:omnibus_protected_paths_present?).and_return(false) - end - - it { is_expected.to be_falsey } - end - end - - context 'when rack_attack.admin_area_protected_paths_enabled config is false' do - before do - stub_config(rack_attack: { - admin_area_protected_paths_enabled: false - }) - end - - context 'when the omnibus protected paths throttle has been recently used (it has data)' do - before do - expect(described_class).to receive(:omnibus_protected_paths_present?).and_return(true) - end - - it { is_expected.to be_truthy } - end - - context 'when the omnibus protected paths throttle has not been recently used' do - before do - expect(described_class).to receive(:omnibus_protected_paths_present?).and_return(false) - end - - it { is_expected.to be_falsey } - end - end - - context 'when rack_attack.admin_area_protected_paths_enabled config is true' do - before do - stub_config(rack_attack: { - admin_area_protected_paths_enabled: true - }) - - expect(described_class).not_to receive(:omnibus_protected_paths_present?) - end - - it { is_expected.to be_falsey } + subject end end end |