BigW Consortium Gitlab

public_group_access_spec.rb 2.54 KB
Newer Older
1 2
require 'spec_helper'

3
describe "Group with public project access" 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
      create(:project, group: group, visibility_level: Gitlab::VisibilityLevel::PUBLIC)
20 21 22 23 24
    end

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

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

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

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

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

49
      it { should be_allowed_for owner }
50 51 52 53
      it { should be_allowed_for master }
      it { should be_allowed_for reporter }
      it { should be_allowed_for :admin }
      it { should be_allowed_for guest }
54 55
      it { should be_allowed_for :user }
      it { should be_allowed_for :visitor }
56 57 58 59 60
    end

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

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

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

73
      it { should be_allowed_for owner }
74 75 76 77 78 79 80 81 82
      it { should be_denied_for master }
      it { should be_denied_for reporter }
      it { should be_allowed_for :admin }
      it { should be_denied_for guest }
      it { should be_denied_for :user }
      it { should be_denied_for :visitor }
    end
  end
end