2016-03-09 11:57:57 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
describe 'Internal Group access', feature: true do
|
2016-03-09 11:57:57 -05:00
|
|
|
include AccessMatchers
|
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
let(:group) { create(:group, :internal) }
|
|
|
|
let(:project) { create(:project, :internal, group: group) }
|
2016-03-17 18:42:46 -04:00
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
let(:owner) { create(:user) }
|
|
|
|
let(:master) { create(:user) }
|
|
|
|
let(:developer) { create(:user) }
|
|
|
|
let(:reporter) { create(:user) }
|
|
|
|
let(:guest) { create(:user) }
|
2016-03-09 11:57:57 -05:00
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
let(:project_guest) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
group.add_user(owner, Gitlab::Access::OWNER)
|
|
|
|
group.add_user(master, Gitlab::Access::MASTER)
|
|
|
|
group.add_user(developer, Gitlab::Access::DEVELOPER)
|
|
|
|
group.add_user(reporter, Gitlab::Access::REPORTER)
|
|
|
|
group.add_user(guest, Gitlab::Access::GUEST)
|
|
|
|
|
|
|
|
project.team << [project_guest, :guest]
|
2016-03-09 11:57:57 -05:00
|
|
|
end
|
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
describe "Group should be internal" do
|
|
|
|
describe '#internal?' do
|
|
|
|
subject { group.internal? }
|
|
|
|
it { is_expected.to be_truthy }
|
2016-03-09 11:57:57 -05:00
|
|
|
end
|
2016-03-20 16:03:53 -04:00
|
|
|
end
|
2016-03-09 11:57:57 -05:00
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
describe 'GET /groups/:path' do
|
|
|
|
subject { group_path(group) }
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for :admin }
|
|
|
|
it { is_expected.to be_allowed_for owner }
|
|
|
|
it { is_expected.to be_allowed_for master }
|
|
|
|
it { is_expected.to be_allowed_for developer }
|
|
|
|
it { is_expected.to be_allowed_for reporter }
|
|
|
|
it { is_expected.to be_allowed_for guest }
|
|
|
|
it { is_expected.to be_allowed_for project_guest }
|
|
|
|
it { is_expected.to be_allowed_for :user }
|
|
|
|
it { is_expected.to be_denied_for :external }
|
|
|
|
it { is_expected.to be_denied_for :visitor }
|
2016-03-09 11:57:57 -05:00
|
|
|
end
|
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
describe 'GET /groups/:path/issues' do
|
|
|
|
subject { issues_group_path(group) }
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for :admin }
|
|
|
|
it { is_expected.to be_allowed_for owner }
|
|
|
|
it { is_expected.to be_allowed_for master }
|
|
|
|
it { is_expected.to be_allowed_for developer }
|
|
|
|
it { is_expected.to be_allowed_for reporter }
|
|
|
|
it { is_expected.to be_allowed_for guest }
|
|
|
|
it { is_expected.to be_allowed_for project_guest }
|
|
|
|
it { is_expected.to be_allowed_for :user }
|
|
|
|
it { is_expected.to be_denied_for :external }
|
|
|
|
it { is_expected.to be_denied_for :visitor }
|
|
|
|
end
|
2016-03-09 11:57:57 -05:00
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
describe 'GET /groups/:path/merge_requests' do
|
|
|
|
subject { merge_requests_group_path(group) }
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for :admin }
|
|
|
|
it { is_expected.to be_allowed_for owner }
|
|
|
|
it { is_expected.to be_allowed_for master }
|
|
|
|
it { is_expected.to be_allowed_for developer }
|
|
|
|
it { is_expected.to be_allowed_for reporter }
|
|
|
|
it { is_expected.to be_allowed_for guest }
|
|
|
|
it { is_expected.to be_allowed_for project_guest }
|
|
|
|
it { is_expected.to be_allowed_for :user }
|
|
|
|
it { is_expected.to be_denied_for :external }
|
|
|
|
it { is_expected.to be_denied_for :visitor }
|
2016-03-09 11:57:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
describe 'GET /groups/:path/group_members' do
|
2016-03-20 16:03:53 -04:00
|
|
|
subject { group_group_members_path(group) }
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for :admin }
|
|
|
|
it { is_expected.to be_allowed_for owner }
|
|
|
|
it { is_expected.to be_allowed_for master }
|
|
|
|
it { is_expected.to be_allowed_for developer }
|
|
|
|
it { is_expected.to be_allowed_for reporter }
|
|
|
|
it { is_expected.to be_allowed_for guest }
|
|
|
|
it { is_expected.to be_allowed_for project_guest }
|
|
|
|
it { is_expected.to be_allowed_for :user }
|
|
|
|
it { is_expected.to be_denied_for :external }
|
|
|
|
it { is_expected.to be_denied_for :visitor }
|
2016-03-09 11:57:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /groups/:path/edit' do
|
2016-03-20 16:03:53 -04:00
|
|
|
subject { edit_group_path(group) }
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for :admin }
|
|
|
|
it { is_expected.to be_allowed_for owner }
|
|
|
|
it { is_expected.to be_denied_for master }
|
|
|
|
it { is_expected.to be_denied_for developer }
|
|
|
|
it { is_expected.to be_denied_for reporter }
|
|
|
|
it { is_expected.to be_denied_for guest }
|
|
|
|
it { is_expected.to be_denied_for project_guest }
|
|
|
|
it { is_expected.to be_denied_for :user }
|
|
|
|
it { is_expected.to be_denied_for :visitor }
|
|
|
|
it { is_expected.to be_denied_for :external }
|
2016-03-09 11:57:57 -05:00
|
|
|
end
|
|
|
|
end
|