diff options
Diffstat (limited to 'spec/helpers/projects_helper_spec.rb')
-rw-r--r-- | spec/helpers/projects_helper_spec.rb | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 124cdcec05d..1804a9a99cf 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -390,149 +390,6 @@ RSpec.describe ProjectsHelper do end end - describe '#get_project_nav_tabs' do - before do - allow(helper).to receive(:current_user).and_return(user) - allow(helper).to receive(:can?) { true } - end - - subject do - helper.send(:get_project_nav_tabs, project, user) - end - - context 'Security & Compliance tabs' do - before do - allow(helper).to receive(:can?).with(user, :read_security_configuration, project).and_return(can_read_security_configuration) - end - - context 'when user cannot read security configuration' do - let(:can_read_security_configuration) { false } - - it { is_expected.not_to include(:security_configuration) } - end - - context 'when user can read security configuration' do - let(:can_read_security_configuration) { true } - let(:feature_flag_enabled) { true } - - it { is_expected.to include(:security_configuration) } - end - end - - context 'when builds feature is enabled' do - before do - allow(project).to receive(:builds_enabled?).and_return(true) - end - - it "does include pipelines tab" do - is_expected.to include(:pipelines) - end - end - - context 'when builds feature is disabled' do - before do - allow(project).to receive(:builds_enabled?).and_return(false) - end - - context 'when user has access to builds' do - it "does include pipelines tab" do - is_expected.to include(:pipelines) - end - end - - context 'when user does not have access to builds' do - before do - allow(helper).to receive(:can?) { false } - end - - it "does not include pipelines tab" do - is_expected.not_to include(:pipelines) - end - end - end - - context 'when project has external wiki' do - it 'includes external wiki tab' do - project.create_external_wiki_service(active: true, properties: { 'external_wiki_url' => 'https://gitlab.com' }) - project.reload - - is_expected.to include(:external_wiki) - end - end - - context 'when project does not have external wiki' do - it 'does not include external wiki tab' do - expect(project.external_wiki).to be_nil - is_expected.not_to include(:external_wiki) - end - end - - context 'when project has confluence enabled' do - before do - allow(project).to receive(:has_confluence?).and_return(true) - end - - it { is_expected.to include(:confluence) } - it { is_expected.not_to include(:wiki) } - end - - context 'when project does not have confluence enabled' do - it { is_expected.not_to include(:confluence) } - it { is_expected.to include(:wiki) } - end - - context 'learn gitlab experiment' do - context 'when it is enabled' do - before do - expect(helper).to receive(:learn_gitlab_experiment_enabled?).with(project).and_return(true) - end - - it { is_expected.to include(:learn_gitlab) } - end - - context 'when it is not enabled' do - it { is_expected.not_to include(:learn_gitlab) } - end - end - end - - describe '#can_view_operations_tab?' do - before do - allow(helper).to receive(:current_user).and_return(user) - allow(helper).to receive(:can?).and_return(false) - end - - subject { helper.send(:can_view_operations_tab?, user, project) } - - where(:ability) do - [ - :metrics_dashboard, - :read_alert_management_alert, - :read_environment, - :read_issue, - :read_sentry_issue, - :read_cluster - ] - end - - with_them do - it 'includes operations tab' do - allow(helper).to receive(:can?).with(user, ability, project).and_return(true) - - is_expected.to be(true) - end - - context 'when operations feature is disabled' do - it 'does not include operations tab' do - allow(helper).to receive(:can?).with(user, ability, project).and_return(true) - project.project_feature.update_attribute(:operations_access_level, ProjectFeature::DISABLED) - - is_expected.to be(false) - end - end - end - end - describe '#show_projects' do let(:projects) do Project.all |