Commit d12d89b6 authored by Mike Greiling's avatar Mike Greiling

hide pipeline quota link when group has no projects which are limited and add tests

parent a64e28fe
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
= link_to group_audit_events_path(@group), title: "Audit Events" do = link_to group_audit_events_path(@group), title: "Audit Events" do
%span %span
Audit Events Audit Events
- if @group.shared_runners_enabled? && @group.shared_runners_minutes_limit_enabled?
= nav_link(controller: :pipeline_quota) do = nav_link(controller: :pipeline_quota) do
= link_to group_pipeline_quota_path(@group), title: "Pipeline Quota" do = link_to group_pipeline_quota_path(@group), title: "Pipeline Quota" do
%span %span
......
...@@ -13,6 +13,14 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -13,6 +13,14 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'with no quota' do context 'with no quota' do
let(:group) { create(:group, :with_build_minutes) } let(:group) { create(:group, :with_build_minutes) }
it 'is not linked within the group settings dropdown' do
visit group_path(group)
page.within('.layout-nav') do
expect(page).not_to have_selector(:link_or_button, 'Pipeline Quota')
end
end
it 'shows correct ratio and status' do it 'shows correct ratio and status' do
visit_pipeline_quota_page visit_pipeline_quota_page
...@@ -27,6 +35,14 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -27,6 +35,14 @@ feature 'Groups > Pipeline Quota', feature: true do
let(:group) { create(:group, :with_not_used_build_minutes_limit) } let(:group) { create(:group, :with_not_used_build_minutes_limit) }
let!(:project) { create(:project, namespace: group, shared_runners_enabled: false) } let!(:project) { create(:project, namespace: group, shared_runners_enabled: false) }
it 'is not linked within the group settings dropdown' do
visit group_path(group)
page.within('.layout-nav') do
expect(page).not_to have_selector(:link_or_button, 'Pipeline Quota')
end
end
it 'shows correct ratio and status' do it 'shows correct ratio and status' do
visit_pipeline_quota_page visit_pipeline_quota_page
...@@ -40,6 +56,14 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -40,6 +56,14 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'minutes under quota' do context 'minutes under quota' do
let(:group) { create(:group, :with_not_used_build_minutes_limit) } let(:group) { create(:group, :with_not_used_build_minutes_limit) }
it 'is linked within the group settings dropdown' do
visit group_path(group)
page.within('.layout-nav') do
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
end
it 'shows correct ratio and status' do it 'shows correct ratio and status' do
visit_pipeline_quota_page visit_pipeline_quota_page
...@@ -54,6 +78,14 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -54,6 +78,14 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'minutes over quota' do context 'minutes over quota' do
let(:group) { create(:group, :with_used_build_minutes_limit) } let(:group) { create(:group, :with_used_build_minutes_limit) }
it 'is linked within the group settings dropdown' do
visit group_path(group)
page.within('.layout-nav') do
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
end
it 'shows correct ratio and status' do it 'shows correct ratio and status' do
visit_pipeline_quota_page visit_pipeline_quota_page
......
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