diff options
Diffstat (limited to 'spec/views/layouts')
3 files changed, 156 insertions, 6 deletions
diff --git a/spec/views/layouts/header/_new_dropdown.haml_spec.rb b/spec/views/layouts/header/_new_dropdown.haml_spec.rb index 319e7b55fc3..47abfff87bb 100644 --- a/spec/views/layouts/header/_new_dropdown.haml_spec.rb +++ b/spec/views/layouts/header/_new_dropdown.haml_spec.rb @@ -71,7 +71,7 @@ RSpec.describe 'layouts/header/_new_dropdown' do before do allow(view).to receive(:can?).with(user, :create_projects, group).and_return(true) allow(view).to receive(:can?).with(user, :admin_group_member, group).and_return(invite_member) - allow(view).to receive(:can_import_members?).and_return(invite_member) + allow(view).to receive(:can_admin_project_member?).and_return(invite_member) allow(view).to receive(:experiment_enabled?) end @@ -142,7 +142,7 @@ RSpec.describe 'layouts/header/_new_dropdown' do let(:href) { project_project_members_path(project) } before do - allow(view).to receive(:can_import_members?).and_return(invite_member) + allow(view).to receive(:can_admin_project_member?).and_return(invite_member) stub_current_user(user) allow(view).to receive(:experiment_enabled?) end diff --git a/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb index 7df076d35c4..8c9d1b32671 100644 --- a/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb @@ -3,10 +3,17 @@ require 'spec_helper' RSpec.describe 'layouts/nav/sidebar/_group' do - let_it_be(:group) { create(:group) } + let_it_be(:owner) { create(:user) } + let_it_be(:group) do + create(:group).tap do |g| + g.add_owner(owner) + end + end before do assign(:group, group) + + allow(view).to receive(:current_user).and_return(owner) end it_behaves_like 'has nav sidebar' @@ -27,11 +34,154 @@ RSpec.describe 'layouts/nav/sidebar/_group' do expect(rendered).to have_link('Group information', href: activity_group_path(group)) end + it 'has a link to the group labels path' do + render + + expect(rendered).to have_link('Labels', href: group_labels_path(group)) + end + it 'has a link to the members page' do render - expect(rendered).to have_selector('.sidebar-top-level-items > li.home a[title="Members"]') expect(rendered).to have_link('Members', href: group_group_members_path(group)) end end + + describe 'Issues' do + it 'has a default link to the issue list path' do + render + + expect(rendered).to have_link('Issues', href: issues_group_path(group)) + end + + it 'has a link to the issue list page' do + render + + expect(rendered).to have_link('List', href: issues_group_path(group)) + end + + it 'has a link to the boards page' do + render + + expect(rendered).to have_link('Board', href: group_boards_path(group)) + end + + it 'has a link to the milestones page' do + render + + expect(rendered).to have_link('Milestones', href: group_milestones_path(group)) + end + end + + describe 'Merge Requests' do + it 'has a link to the merge request list path' do + render + + expect(rendered).to have_link('Merge requests', href: merge_requests_group_path(group)) + end + + it 'shows pill with the number of merge requests' do + render + + expect(rendered).to have_css('span.badge.badge-pill.merge_counter.js-merge-counter') + end + end + + describe 'CI/CD' do + it 'has a default link to the runners list path' do + render + + expect(rendered).to have_link('CI/CD', href: group_runners_path(group)) + end + + it 'has a link to the runners list page' do + render + + expect(rendered).to have_link('Runners', href: group_runners_path(group)) + end + end + + describe 'Kubernetes menu' do + it 'has a link to the group cluster list path' do + render + + expect(rendered).to have_link('Kubernetes', href: group_clusters_path(group)) + end + end + + describe 'Packages & Registries' do + it 'has a link to the package registry page' do + stub_config(packages: { enabled: true }) + + render + + expect(rendered).to have_link('Package Registry', href: group_packages_path(group)) + end + + it 'has a link to the container registry page' do + stub_container_registry_config(enabled: true) + + render + + expect(rendered).to have_link('Container Registry', href: group_container_registries_path(group)) + end + + it 'has a link to the dependency proxy page' do + stub_config(dependency_proxy: { enabled: true }) + + render + + expect(rendered).to have_link('Dependency Proxy', href: group_dependency_proxy_path(group)) + end + end + + describe 'Settings' do + it 'default link points to edit group page' do + render + + expect(rendered).to have_link('Settings', href: edit_group_path(group)) + end + + it 'has a link to the General settings page' do + render + + expect(rendered).to have_link('General', href: edit_group_path(group)) + end + + it 'has a link to the Integrations settings page' do + render + + expect(rendered).to have_link('Integrations', href: group_settings_integrations_path(group)) + end + + it 'has a link to the group Projects settings page' do + render + + expect(rendered).to have_link('Projects', href: projects_group_path(group)) + end + + it 'has a link to the Repository settings page' do + render + + expect(rendered).to have_link('Repository', href: group_settings_repository_path(group)) + end + + it 'has a link to the CI/CD settings page' do + render + + expect(rendered).to have_link('CI/CD', href: group_settings_ci_cd_path(group)) + end + + it 'has a link to the Applications settings page' do + render + + expect(rendered).to have_link('Applications', href: group_settings_applications_path(group)) + end + + it 'has a link to the Package & Registries settings page' do + render + + expect(rendered).to have_link('Packages & Registries', href: group_settings_packages_and_registries_path(group)) + end + end end diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index f2de43dfd19..3afebfbedab 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -640,9 +640,9 @@ RSpec.describe 'layouts/nav/sidebar/_project' do expect(rendered).to have_link('Infrastructure Registry', href: project_infrastructure_registry_index_path(project)) end - context 'when feature flag :infrastructure_registry_page is disabled' do + context 'when package registry config is disabled' do it 'does not show link to package registry page' do - stub_feature_flags(infrastructure_registry_page: false) + stub_config(packages: { enabled: false }) render |