Commit f732b346 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '327484_activate_correct_nav_item' into 'master'

Activate correct nav item for Admin::LicensesController

See merge request gitlab-org/gitlab!66051
parents 5755cea9 8055de72
= nav_link(controller: 'admin/subscriptions') do
= nav_link(controller: ['admin/subscriptions', 'admin/licenses']) do
= link_to admin_subscription_path, class: "qa-link-subscription-menu" do
.nav-icon-container
= sprite_icon('license')
%span.nav-item-name
= _('Subscription')
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(controller: controller, html_options: { class: "fly-out-top-item" } ) do
= nav_link(controller: ['admin/subscriptions', 'admin/licenses'], html_options: { class: "fly-out-top-item" } ) do
= link_to admin_subscription_path do
%strong.fly-out-top-item-name
= _('Subscription')
......@@ -43,12 +43,20 @@ RSpec.describe "Admin uploads license", :js do
File.write(path, license.export)
end
shared_examples 'active navigation item' do
it 'activates the "Subscription" navigation item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Subscription')
end
end
context "when license is valid" do
let_it_be(:path) { Rails.root.join("tmp/valid_license.gitlab-license") }
context "when license is active immediately" do
let_it_be(:license) { build(:gitlab_license) }
it_behaves_like 'active navigation item'
it "uploads license" do
attach_and_upload(path)
......@@ -61,6 +69,8 @@ RSpec.describe "Admin uploads license", :js do
let_it_be(:license) { build(:gitlab_license, starts_at: Date.current + 1.month) }
context "when a current license exists" do
it_behaves_like 'active navigation item'
it "uploads license" do
attach_and_upload(path)
......@@ -74,6 +84,8 @@ RSpec.describe "Admin uploads license", :js do
allow(License).to receive(:current).and_return(nil)
end
it_behaves_like 'active navigation item'
it "uploads license" do
attach_and_upload(path)
......@@ -87,6 +99,8 @@ RSpec.describe "Admin uploads license", :js do
let_it_be(:license) { build(:gitlab_license, expires_at: Date.yesterday) }
let_it_be(:path) { Rails.root.join("tmp/invalid_license.gitlab-license") }
it_behaves_like 'active navigation item'
it "doesn't upload license" do
attach_and_upload(path)
......
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