BigW Consortium Gitlab

guest_navigation_menu_spec.rb 2.36 KB
Newer Older
1 2
require 'spec_helper'

Valery Sizov committed
3
describe 'Guest navigation menu' do
4 5
  let(:project) { create(:empty_project, :private, public_builds: false) }
  let(:guest) { create(:user) }
6 7 8 9

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

10
    gitlab_sign_in(guest)
11 12
  end

Valery Sizov committed
13
  it 'shows allowed tabs only' do
14 15
    visit namespace_project_path(project.namespace, project)

Valery Sizov committed
16
    within('.layout-nav') do
17 18 19 20 21 22 23 24 25
      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
26

Valery Sizov committed
27
  it 'does not show fork button' do
28 29
    visit namespace_project_path(project.namespace, project)

Valery Sizov committed
30
    within('.count-buttons') do
31 32 33 34
      expect(page).not_to have_link 'Fork'
    end
  end

Valery Sizov committed
35
  it 'does not show clone path' do
36 37
    visit namespace_project_path(project.namespace, project)

Valery Sizov committed
38
    within('.project-repo-buttons') do
39 40 41 42 43 44
      expect(page).not_to have_selector '.project-clone-holder'
    end
  end

  describe 'project landing page' do
    before do
Valery Sizov committed
45 46 47 48
      project.project_feature.update!(
        issues_access_level: ProjectFeature::DISABLED,
        wiki_access_level: ProjectFeature::DISABLED
      )
49 50
    end

Valery Sizov committed
51
    it 'does not show the project file list landing page' do
52
      visit namespace_project_path(project.namespace, project)
Valery Sizov committed
53

54 55 56
      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'
Valery Sizov committed
57
      expect(page).to have_selector '.project-show-customize_workflow'
58 59
    end

Valery Sizov committed
60
    it 'shows the customize workflow when issues and wiki are disabled' do
61
      visit namespace_project_path(project.namespace, project)
Valery Sizov committed
62

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

Valery Sizov committed
66 67 68
    it 'shows the wiki when enabled' do
      project.project_feature.update!(wiki_access_level: ProjectFeature::PRIVATE)

69
      visit namespace_project_path(project.namespace, project)
Valery Sizov committed
70

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

Valery Sizov committed
74 75 76
    it 'shows the issues when enabled' do
      project.project_feature.update!(issues_access_level: ProjectFeature::PRIVATE)

77
      visit namespace_project_path(project.namespace, project)
Valery Sizov committed
78

79 80 81
      expect(page).to have_selector '.issues-list'
    end
  end
82
end