2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
describe "Private Project Access" do
|
2015-09-11 14:41:01 +05:30
|
|
|
include AccessMatchers
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
set(:project) { create(:project, :private, :repository, public_builds: false) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
describe "Project should be private" do
|
2015-04-26 12:48:37 +05:30
|
|
|
describe '#private?' do
|
2016-06-02 11:05:42 +05:30
|
|
|
subject { project.private? }
|
2019-12-21 20:55:43 +05:30
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/tree/master" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_tree_path(project, project.repository.root_ref) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/commits/master" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_commits_path(project, project.repository.root_ref, limit: 1) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/commit/:sha" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_commit_path(project, project.repository.commit) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/compare" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_compare_index_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/settings/members" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_settings_members_path(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/settings/ci_cd" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_settings_ci_cd_path(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/settings/repository" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_settings_repository_path(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/blob" do
|
2016-06-02 11:05:42 +05:30
|
|
|
let(:commit) { project.repository.commit }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
subject { project_blob_path(project, File.join(commit.id, '.gitignore')) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/edit" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { edit_project_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/deploy_keys" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_deploy_keys_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/issues" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_issues_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
describe "GET /:project_path/issues/:id/edit" do
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { edit_project_issue_path(project, issue) }
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
describe "GET /:project_path/snippets" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_snippets_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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_denied_for(:user) }
|
|
|
|
it { is_expected.to be_denied_for(:external) }
|
|
|
|
it { is_expected.to be_denied_for(:visitor) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/merge_requests" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_merge_requests_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/branches" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_branches_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
# Speed increase
|
2019-12-26 22:10:19 +05:30
|
|
|
allow_next_instance_of(Project) do |instance|
|
|
|
|
allow(instance).to receive(:branches).and_return([])
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/tags" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_tags_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
# Speed increase
|
2019-12-26 22:10:19 +05:30
|
|
|
allow_next_instance_of(Project) do |instance|
|
|
|
|
allow(instance).to receive(:tags).and_return([])
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/settings/integrations" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_settings_integrations_path(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
describe "GET /:project_path/pipelines" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_pipelines_path(project) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
|
|
|
|
|
|
|
context 'when public builds is enabled' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when public buils are disabled' do
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/pipelines/:id" do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_pipeline_path(project, pipeline) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
|
|
|
|
|
|
|
context 'when public builds is enabled' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when public buils are disabled' do
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/builds" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_jobs_path(project) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
|
|
|
|
|
|
|
context 'when public builds is enabled' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when public buils are disabled' do
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/builds/:id" do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
|
|
|
let(:build) { create(:ci_build, pipeline: pipeline) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_job_path(project, build.id) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
|
|
|
|
|
|
|
context 'when public builds is enabled' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when public buils are disabled' do
|
|
|
|
before do
|
|
|
|
project.public_builds = false
|
|
|
|
project.save
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /:project_path/builds/:id/trace' do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
|
|
|
let(:build) { create(:ci_build, pipeline: pipeline) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { trace_project_job_path(project, build.id) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
|
|
|
|
|
|
|
context 'when public builds is enabled' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:guest).of(project) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when public builds is disabled' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_denied_for(:guest).of(project) }
|
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/environments" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_environments_path(project) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/environments/:id" do
|
2016-08-24 12:49:21 +05:30
|
|
|
let(:environment) { create(:environment, project: project) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_environment_path(project, environment) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/environments/:id/deployments" do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:environment) { create(:environment, project: project) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_environment_deployments_path(project, environment) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/environments/new" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { new_project_environment_path(project) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/pipeline_schedules" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_pipeline_schedules_path(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:developer).of(project) }
|
2019-02-02 18:00:53 +05:30
|
|
|
it { is_expected.to be_denied_for(:reporter).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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/pipeline_schedules/new" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { new_project_pipeline_schedule_path(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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) }
|
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
describe "GET /:project_path/-/environments/new" do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { new_project_pipeline_schedule_path(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /:project_path/container_registry" do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:container_repository) { create(:container_repository) }
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
before do
|
2017-08-17 22:00:37 +05:30
|
|
|
stub_container_registry_tags(repository: :any, tags: ['latest'])
|
2016-08-24 12:49:21 +05:30
|
|
|
stub_container_registry_config(enabled: true)
|
2017-08-17 22:00:37 +05:30
|
|
|
project.container_repositories << container_repository
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { project_container_registry_index_path(project) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it { is_expected.to be_allowed_for(:admin) }
|
|
|
|
it { is_expected.to be_allowed_for(:owner).of(project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
it { is_expected.to be_allowed_for(:maintainer).of(project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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-08-24 12:49:21 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|