BigW Consortium Gitlab

dashboard_access_spec.rb 2.2 KB
Newer Older
1 2
require 'spec_helper'

3
describe "Dashboard access", feature: true  do
4 5
  include AccessMatchers

6
  describe "GET /dashboard" do
Douwe Maan committed
7
    subject { dashboard_projects_path }
8

9 10 11
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
12 13 14 15 16
  end

  describe "GET /dashboard/issues" do
    subject { issues_dashboard_path }

17 18 19
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
20 21 22 23 24
  end

  describe "GET /dashboard/merge_requests" do
    subject { merge_requests_dashboard_path }

25 26 27
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
28 29
  end

30 31
  describe "GET /dashboard/projects/starred" do
    subject { starred_dashboard_projects_path }
32

33 34 35
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
36 37 38 39 40
  end

  describe "GET /help" do
    subject { help_path }

41 42
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
Douwe Maan committed
43
    it { is_expected.to be_allowed_for :visitor }
44 45
  end

46 47 48 49 50 51 52 53 54 55 56 57 58 59
  describe "GET /koding" do
    subject { koding_path }

    context 'with Koding enabled' do
      before do
        stub_application_setting(koding_enabled?: true)
      end

      it { is_expected.to be_allowed_for :admin }
      it { is_expected.to be_allowed_for :user }
      it { is_expected.to be_denied_for :visitor }
    end
  end

60
  describe "GET /projects/new" do
61 62 63
    it { expect(new_project_path).to be_allowed_for :admin }
    it { expect(new_project_path).to be_allowed_for :user }
    it { expect(new_project_path).to be_denied_for :visitor }
64 65 66
  end

  describe "GET /groups/new" do
67 68 69
    it { expect(new_group_path).to be_allowed_for :admin }
    it { expect(new_group_path).to be_allowed_for :user }
    it { expect(new_group_path).to be_denied_for :visitor }
70
  end
71 72 73 74 75 76 77 78

  describe "GET /profile/groups" do
    subject { dashboard_groups_path }

    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
  end
79
end