diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/sidebars/projects/menus/security_compliance_menu_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) | |
download | gitlab-ce-a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4.tar.gz |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/sidebars/projects/menus/security_compliance_menu_spec.rb')
-rw-r--r-- | spec/lib/sidebars/projects/menus/security_compliance_menu_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/sidebars/projects/menus/security_compliance_menu_spec.rb b/spec/lib/sidebars/projects/menus/security_compliance_menu_spec.rb new file mode 100644 index 00000000000..6e84beeb274 --- /dev/null +++ b/spec/lib/sidebars/projects/menus/security_compliance_menu_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Sidebars::Projects::Menus::SecurityComplianceMenu do + let_it_be(:project) { create(:project) } + + let(:user) { project.owner } + let(:show_promotions) { true } + let(:show_discover_project_security) { true } + let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project, show_promotions: show_promotions, show_discover_project_security: show_discover_project_security) } + + describe 'render?' do + subject { described_class.new(context).render? } + + context 'when user is not authenticated' do + let(:user) { nil } + + it { is_expected.to be_falsey } + end + + context 'when user is authenticated' do + context 'when the Security & Compliance is disabled' do + before do + allow(Ability).to receive(:allowed?).with(user, :access_security_and_compliance, project).and_return(false) + end + + it { is_expected.to be_falsey } + end + + context 'when the Security & Compliance is not disabled' do + it { is_expected.to be_truthy } + end + end + end +end |