2013-11-06 10:13:21 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
describe "Internal Project Access" do
|
2015-07-21 22:09:02 -04:00
|
|
|
include AccessMatchers
|
|
|
|
|
2017-07-26 18:01:19 -04:00
|
|
|
set(:project) { create(:project, :internal, :repository) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
|
|
|
describe "Project should be internal" do
|
2015-02-12 13:17:35 -05:00
|
|
|
describe '#internal?' do
|
2016-03-20 16:03:53 -04:00
|
|
|
subject { project.internal? }
|
2015-02-12 13:17:35 -05:00
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/tree/master" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_tree_path(project, project.repository.root_ref) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/commits/master" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_commits_path(project, project.repository.root_ref, limit: 1) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/commit/:sha" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_commit_path(project, project.repository.commit) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/compare" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_compare_index_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
2016-12-27 12:24:28 -05:00
|
|
|
describe "GET /:project_path/settings/members" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_settings_members_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
2017-01-23 17:19:39 -05:00
|
|
|
describe "GET /:project_path/settings/ci_cd" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_settings_ci_cd_path(project) }
|
2017-01-23 17:19:39 -05:00
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
2017-02-10 12:27:43 -05:00
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/settings/repository" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_settings_repository_path(project) }
|
2017-02-10 12:27:43 -05:00
|
|
|
|
2017-01-23 17:19:39 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
end
|
|
|
|
|
2013-11-06 10:13:21 -05:00
|
|
|
describe "GET /:project_path/blob" do
|
2016-03-10 16:08:11 -05:00
|
|
|
let(:commit) { project.repository.commit }
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_blob_path(project, File.join(commit.id, '.gitignore')) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/edit" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { edit_project_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/deploy_keys" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_deploy_keys_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/issues" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_issues_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
2017-10-26 07:04:07 -04:00
|
|
|
describe "GET /:project_path/issues/:id/edit" do
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
|
|
|
subject { edit_project_issue_path(project, issue) }
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
|
|
|
end
|
|
|
|
|
2013-11-06 10:13:21 -05:00
|
|
|
describe "GET /:project_path/snippets" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_snippets_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/snippets/new" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { new_project_snippet_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/merge_requests" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_merge_requests_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/merge_requests/new" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_new_merge_request_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/branches" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_branches_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
|
|
|
before do
|
|
|
|
# Speed increase
|
2015-02-12 13:17:35 -05:00
|
|
|
allow_any_instance_of(Project).to receive(:branches).and_return([])
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/tags" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_tags_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
|
|
|
before do
|
|
|
|
# Speed increase
|
2015-02-12 13:17:35 -05:00
|
|
|
allow_any_instance_of(Project).to receive(:tags).and_return([])
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
2017-01-18 16:40:16 -05:00
|
|
|
describe "GET /:project_path/settings/integrations" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_settings_integrations_path(project) }
|
2013-11-06 10:13:21 -05:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
2016-06-21 04:11:07 -04:00
|
|
|
|
|
|
|
describe "GET /:project_path/pipelines" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_pipelines_path(project) }
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
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-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/pipelines/:id" do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_pipeline_path(project, pipeline) }
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
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-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/builds" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_jobs_path(project) }
|
2016-06-21 04:11:07 -04:00
|
|
|
|
|
|
|
context "when allowed for public and internal" do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
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-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context "when disallowed for public and internal" do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
project.update(public_builds: false)
|
|
|
|
end
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2016-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/builds/:id" do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
|
|
|
let(:build) { create(:ci_build, pipeline: pipeline) }
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_job_path(project, build.id) }
|
2016-06-21 04:11:07 -04:00
|
|
|
|
|
|
|
context "when allowed for public and internal" do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
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-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context "when disallowed for public and internal" do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
project.update(public_builds: false)
|
|
|
|
end
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
2017-04-28 05:38:32 -04:00
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /:project_path/builds/:id/trace' do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
|
|
|
let(:build) { create(:ci_build, pipeline: pipeline) }
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { trace_project_job_path(project, build.id) }
|
2017-04-28 05:38:32 -04:00
|
|
|
|
|
|
|
context 'when allowed for public and internal' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
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
|
|
|
|
|
|
|
|
context 'when disallowed for public and internal' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2016-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-07 18:35:56 -04:00
|
|
|
describe "GET /:project_path/pipeline_schedules" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_pipeline_schedules_path(project) }
|
2017-05-07 18:35:56 -04:00
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
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-06-21 04:11:07 -04:00
|
|
|
describe "GET /:project_path/environments" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_environments_path(project) }
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2016-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/environments/:id" do
|
|
|
|
let(:environment) { create(:environment, project: project) }
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_environment_path(project, environment) }
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2017-04-24 14:00:00 -04:00
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/environments/:id/deployments" do
|
|
|
|
let(:environment) { create(:environment, project: project) }
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_environment_deployments_path(project, environment) }
|
2017-04-24 14:00:00 -04:00
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2016-06-21 04:11:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/environments/new" do
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { new_project_environment_path(project) }
|
2016-06-21 04:11:07 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
it { is_expected.to be_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2016-06-21 04:11:07 -04:00
|
|
|
end
|
2016-07-15 11:05:41 -04:00
|
|
|
|
|
|
|
describe "GET /:project_path/container_registry" do
|
2017-03-23 10:54:59 -04:00
|
|
|
let(:container_repository) { create(:container_repository) }
|
2016-12-15 22:24:05 -05:00
|
|
|
|
2016-07-15 11:05:41 -04:00
|
|
|
before do
|
2017-04-03 09:52:24 -04:00
|
|
|
stub_container_registry_tags(repository: :any, tags: ['latest'])
|
2016-07-15 11:05:41 -04:00
|
|
|
stub_container_registry_config(enabled: true)
|
2017-03-23 10:54:59 -04:00
|
|
|
project.container_repositories << container_repository
|
2016-07-15 11:05:41 -04:00
|
|
|
end
|
|
|
|
|
2017-06-29 13:06:35 -04:00
|
|
|
subject { project_container_registry_index_path(project) }
|
2016-07-15 11:05:41 -04:00
|
|
|
|
2016-11-28 00:08:14 -05:00
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:master).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:reporter).of(project) }
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
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-07-15 11:05:41 -04:00
|
|
|
end
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|