summaryrefslogtreecommitdiff
path: root/spec/policies
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-20 15:09:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-20 15:09:18 +0000
commit364f6f2e33e6f5eafe63b25d9256b88e72141b1c (patch)
treeee6dc003a354e7466d5c45e5587c0f8172312122 /spec/policies
parent98252e0dd60cbcb316231085e206d9872f243b8a (diff)
downloadgitlab-ce-364f6f2e33e6f5eafe63b25d9256b88e72141b1c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r--spec/policies/project_policy_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb
index 188eafadfc1..e47204c774b 100644
--- a/spec/policies/project_policy_spec.rb
+++ b/spec/policies/project_policy_spec.rb
@@ -508,6 +508,34 @@ describe ProjectPolicy do
end
end
+ context 'forking a project' do
+ subject { described_class.new(current_user, project) }
+
+ context 'anonymous user' do
+ let(:current_user) { nil }
+
+ it { is_expected.to be_disallowed(:fork_project) }
+ end
+
+ context 'project member' do
+ let_it_be(:project) { create(:project, :private) }
+
+ context 'guest' do
+ let(:current_user) { guest }
+
+ it { is_expected.to be_disallowed(:fork_project) }
+ end
+
+ %w(reporter developer maintainer).each do |role|
+ context role do
+ let(:current_user) { send(role) }
+
+ it { is_expected.to be_allowed(:fork_project) }
+ end
+ end
+ end
+ end
+
describe 'update_max_artifacts_size' do
subject { described_class.new(current_user, project) }