Commit 5e7b2f71 authored by Rajendra Kadam's avatar Rajendra Kadam

Apply reviews and suggestions

parent c008db06
- return unless current_user.admin? && License.feature_available?(:repository_size_limit) - return unless current_user.admin? && License.feature_available?(:repository_size_limit) || License.features_with_usage_ping.include?(:repository_size_limit)
- form = local_assigns.fetch(:form) - form = local_assigns.fetch(:form)
- type = local_assigns.fetch(:type) - type = local_assigns.fetch(:type)
......
...@@ -42,7 +42,7 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do ...@@ -42,7 +42,7 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do
it_behaves_like 'ip_restriction' it_behaves_like 'ip_restriction'
context 'feature is disabled' do context 'group_ip_restriction feature is disabled' do
before do before do
stub_licensed_features(group_ip_restriction: false) stub_licensed_features(group_ip_restriction: false)
end end
...@@ -56,7 +56,7 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do ...@@ -56,7 +56,7 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do
stub_application_setting(usage_ping_enabled: true) stub_application_setting(usage_ping_enabled: true)
end end
context 'when usage_ping_features_enabled is activated' do context 'when usage_ping_features_enabled is enabled' do
before do before do
stub_application_setting(usage_ping_features_enabled: true) stub_application_setting(usage_ping_features_enabled: true)
end end
...@@ -64,7 +64,7 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do ...@@ -64,7 +64,7 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do
it_behaves_like 'ip_restriction' it_behaves_like 'ip_restriction'
end end
context 'when usage_ping_features_enabled is deactivated' do context 'when usage_ping_features_enabled is disabled' do
before do before do
stub_application_setting(usage_ping_features_enabled: false) stub_application_setting(usage_ping_features_enabled: false)
end end
...@@ -72,5 +72,14 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do ...@@ -72,5 +72,14 @@ RSpec.describe Gitlab::IpRestriction::Enforcer do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
end end
context 'when usage ping is disabled' do
before do
stub_licensed_features(group_ip_restriction: false)
stub_application_setting(usage_ping_enabled: false)
end
it { is_expected.to be_truthy }
end
end end
end end
...@@ -2363,7 +2363,7 @@ RSpec.describe Project do ...@@ -2363,7 +2363,7 @@ RSpec.describe Project do
stub_licensed_features(repository_size_limit: true) stub_licensed_features(repository_size_limit: true)
end end
it 'is enabled' do it 'size limit is enabled' do
expect(checker.enabled?).to be_truthy expect(checker.enabled?).to be_truthy
end end
end end
...@@ -2373,7 +2373,7 @@ RSpec.describe Project do ...@@ -2373,7 +2373,7 @@ RSpec.describe Project do
stub_licensed_features(repository_size_limit: false) stub_licensed_features(repository_size_limit: false)
end end
it 'is disabled' do it 'size limit is disabled' do
expect(checker.enabled?).to be_falsey expect(checker.enabled?).to be_falsey
end end
end end
...@@ -2384,26 +2384,37 @@ RSpec.describe Project do ...@@ -2384,26 +2384,37 @@ RSpec.describe Project do
stub_application_setting(usage_ping_enabled: true) stub_application_setting(usage_ping_enabled: true)
end end
context 'when feature is activated' do context 'when usage_ping_features is activated' do
before do before do
stub_application_setting(usage_ping_features_enabled: true) stub_application_setting(usage_ping_features_enabled: true)
end end
it 'is enabled' do it 'size limit is enabled' do
expect(checker.enabled?).to be_truthy expect(checker.enabled?).to be_truthy
end end
end end
context 'when feature is deactivated' do context 'when usage_ping_features is disabled' do
before do before do
stub_application_setting(usage_ping_features_enabled: false) stub_application_setting(usage_ping_features_enabled: false)
end end
it 'is disabled' do it 'size limit is disabled' do
expect(checker.enabled?).to be_falsy expect(checker.enabled?).to be_falsy
end end
end end
end end
context 'when usage ping is disabled' do
before do
stub_licensed_features(repository_size_limit: false)
stub_application_setting(usage_ping_enabled: false)
end
it 'size limit is disabled' do
expect(checker.enabled?).to be_falsey
end
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment