<commit_before>require 'spec_helper'

describe "Guest navigation menu" do
  let(:project) { create(:empty_project, :private, public_builds: false) }
  let(:guest) { create(:user) }

  before do
    project.team << [guest, :guest]

    login_as(guest)
  end

  it "shows allowed tabs only" do
    visit namespace_project_path(project.namespace, project)

    within(".layout-nav") do
      expect(page).to have_content 'Project'
      expect(page).to have_content 'Issues'
      expect(page).to have_content 'Wiki'

      expect(page).not_to have_content 'Repository'
      expect(page).not_to have_content 'Pipelines'
      expect(page).not_to have_content 'Merge Requests'
    end
  end

  it "does not show fork button" do
    visit namespace_project_path(project.namespace, project)

    within(".count-buttons") do
      expect(page).not_to have_link 'Fork'
    end
  end

  it "does not show clone path" do
    visit namespace_project_path(project.namespace, project)

    within(".project-repo-buttons") do
      expect(page).not_to have_selector '.project-clone-holder'
    end
  end

  describe 'project landing page' do
    before do
      project.project_feature.update_attribute("issues_access_level", ProjectFeature::DISABLED)
      project.project_feature.update_attribute("wiki_access_level", ProjectFeature::DISABLED)
    end

    it "does not show the project file list landing page" do
      visit namespace_project_path(project.namespace, project)
      expect(page).not_to have_selector '.project-stats'
      expect(page).not_to have_selector '.project-last-commit'
      expect(page).not_to have_selector '.project-show-files'
    end

    it "shows the customize workflow when issues and wiki are disabled" do
      visit namespace_project_path(project.namespace, project)
      expect(page).to have_selector '.project-show-customize_workflow'
    end

    it "shows the wiki when enabled" do
      project.project_feature.update_attribute("wiki_access_level", ProjectFeature::PRIVATE)
      visit namespace_project_path(project.namespace, project)
      expect(page).to have_selector '.project-show-wiki'
    end

    it "shows the issues when enabled" do
      project.project_feature.update_attribute("issues_access_level", ProjectFeature::PRIVATE)
      visit namespace_project_path(project.namespace, project)
      expect(page).to have_selector '.issues-list'
    end
  end
end<commit_msg>Fix review comment<commit_after>require 'spec_helper'

describe 'Guest navigation menu' do
  let(:project) { create(:empty_project, :private, public_builds: false) }
  let(:guest) { create(:user) }

  before do
    project.team << [guest, :guest]

    login_as(guest)
  end

  it 'shows allowed tabs only' do
    visit namespace_project_path(project.namespace, project)

    within('.layout-nav') do
      expect(page).to have_content 'Project'
      expect(page).to have_content 'Issues'
      expect(page).to have_content 'Wiki'

      expect(page).not_to have_content 'Repository'
      expect(page).not_to have_content 'Pipelines'
      expect(page).not_to have_content 'Merge Requests'
    end
  end

  it 'does not show fork button' do
    visit namespace_project_path(project.namespace, project)

    within('.count-buttons') do
      expect(page).not_to have_link 'Fork'
    end
  end

  it 'does not show clone path' do
    visit namespace_project_path(project.namespace, project)

    within('.project-repo-buttons') do
      expect(page).not_to have_selector '.project-clone-holder'
    end
  end

  describe 'project landing page' do
    before do
      project.project_feature.update!(
        issues_access_level: ProjectFeature::DISABLED,
        wiki_access_level: ProjectFeature::DISABLED
      )
    end

    it 'does not show the project file list landing page' do
      visit namespace_project_path(project.namespace, project)

      expect(page).not_to have_selector '.project-stats'
      expect(page).not_to have_selector '.project-last-commit'
      expect(page).not_to have_selector '.project-show-files'
      expect(page).to have_selector '.project-show-customize_workflow'
    end

    it 'shows the customize workflow when issues and wiki are disabled' do
      visit namespace_project_path(project.namespace, project)

      expect(page).to have_selector '.project-show-customize_workflow'
    end

    it 'shows the wiki when enabled' do
      project.project_feature.update!(wiki_access_level: ProjectFeature::PRIVATE)

      visit namespace_project_path(project.namespace, project)

      expect(page).to have_selector '.project-show-wiki'
    end

    it 'shows the issues when enabled' do
      project.project_feature.update!(issues_access_level: ProjectFeature::PRIVATE)

      visit namespace_project_path(project.namespace, project)

      expect(page).to have_selector '.issues-list'
    end
  end
end
{'fraction_non_alphanumeric': 0.09221902017291066, 'fraction_numerical': 0.0, 'mean_word_length': 3.7637254901960784, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5895614', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1401, 'n_words': 357}