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,9 +28,10 @@
= link_to group_audit_events_path(@group), title: "Audit Events" do
%span
Audit Events
= nav_link(controller: :pipeline_quota) do
= link_to group_pipeline_quota_path(@group), title: "Pipeline Quota" do
%span
Pipeline Quota
- if @group.shared_runners_enabled? && @group.shared_runners_minutes_limit_enabled?
= nav_link(controller: :pipeline_quota) do
= link_to group_pipeline_quota_path(@group), title: "Pipeline Quota" do
%span
Pipeline Quota
%li
= link_to 'Edit Group', edit_group_path(@group)
......@@ -13,6 +13,14 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'with no quota' do
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
visit_pipeline_quota_page
......@@ -27,6 +35,14 @@ feature 'Groups > Pipeline Quota', feature: true do
let(:group) { create(:group, :with_not_used_build_minutes_limit) }
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
visit_pipeline_quota_page
......@@ -40,6 +56,14 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'minutes under quota' do
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
visit_pipeline_quota_page
......@@ -54,6 +78,14 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'minutes over quota' do
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
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