BigW Consortium Gitlab

mixed_group_access_spec.rb 2.87 KB
Newer Older
1 2
require 'spec_helper'

3
describe "Group access", feature: true  do
4 5 6
  describe "Group" do
    let(:group) { create(:group) }

7
    let(:owner)   { create(:owner) }
8 9 10
    let(:master)   { create(:user) }
    let(:reporter) { create(:user) }
    let(:guest)    { create(:user) }
11
    let(:nonmember)  { create(:user) }
12 13

    before do
14
      group.add_user(owner, Gitlab::Access::OWNER)
15 16 17
      group.add_user(master, Gitlab::Access::MASTER)
      group.add_user(reporter, Gitlab::Access::REPORTER)
      group.add_user(guest, Gitlab::Access::GUEST)
18

19 20
      create(:project, :internal, path: "internal_project", group: group)
      create(:project, :public, path: "public_project", group: group)
21
    end
22 23 24 25

    describe "GET /groups/:path" do
      subject { group_path(group) }

26 27 28 29 30 31 32
      it { is_expected.to be_allowed_for owner }
      it { is_expected.to be_allowed_for master }
      it { is_expected.to be_allowed_for reporter }
      it { is_expected.to be_allowed_for :admin }
      it { is_expected.to be_allowed_for guest }
      it { is_expected.to be_allowed_for :user }
      it { is_expected.to be_allowed_for :visitor }
33 34 35 36 37
    end

    describe "GET /groups/:path/issues" do
      subject { issues_group_path(group) }

38 39 40 41 42 43 44
      it { is_expected.to be_allowed_for owner }
      it { is_expected.to be_allowed_for master }
      it { is_expected.to be_allowed_for reporter }
      it { is_expected.to be_allowed_for :admin }
      it { is_expected.to be_allowed_for guest }
      it { is_expected.to be_allowed_for :user }
      it { is_expected.to be_allowed_for :visitor }
45 46 47 48 49
    end

    describe "GET /groups/:path/merge_requests" do
      subject { merge_requests_group_path(group) }

50 51 52 53 54 55 56
      it { is_expected.to be_allowed_for owner }
      it { is_expected.to be_allowed_for master }
      it { is_expected.to be_allowed_for reporter }
      it { is_expected.to be_allowed_for :admin }
      it { is_expected.to be_allowed_for guest }
      it { is_expected.to be_allowed_for :user }
      it { is_expected.to be_allowed_for :visitor }
57 58
    end

59 60
    describe "GET /groups/:path/group_members" do
      subject { group_group_members_path(group) }
61

62 63 64 65 66 67 68
      it { is_expected.to be_allowed_for owner }
      it { is_expected.to be_allowed_for master }
      it { is_expected.to be_allowed_for reporter }
      it { is_expected.to be_allowed_for :admin }
      it { is_expected.to be_allowed_for guest }
      it { is_expected.to be_allowed_for :user }
      it { is_expected.to be_allowed_for :visitor }
69 70 71 72 73
    end

    describe "GET /groups/:path/edit" do
      subject { edit_group_path(group) }

74 75 76 77 78 79 80
      it { is_expected.to be_allowed_for owner }
      it { is_expected.to be_denied_for master }
      it { is_expected.to be_denied_for reporter }
      it { is_expected.to be_allowed_for :admin }
      it { is_expected.to be_denied_for guest }
      it { is_expected.to be_denied_for :user }
      it { is_expected.to be_denied_for :visitor }
81 82 83
    end
  end
end