Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-09-29 14:14:39 +0300
committerPhil Hughes <me@iamphill.com>2017-09-29 14:14:39 +0300
commit93aa6d04c2e81193d7833890d2281fc1df7d7129 (patch)
tree166a52d9ffdf1bbd3ef073b88626707e9a1acc16 /spec/policies/global_policy_spec.rb
parent8585ae61e730a48fc0688417b24279c48b59dada (diff)
moved fork checks into policies
Diffstat (limited to 'spec/policies/global_policy_spec.rb')
-rw-r--r--spec/policies/global_policy_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb
index 983f0e52d31..5b8cf2e6ab5 100644
--- a/spec/policies/global_policy_spec.rb
+++ b/spec/policies/global_policy_spec.rb
@@ -52,6 +52,29 @@ describe GlobalPolicy do
end
end
+ describe "create fork" do
+ context "when user has not exceeded project limit" do
+ it { is_expected.to be_allowed(:create_fork) }
+ end
+
+ context "when user has exceeded project limit" do
+ let(:current_user) { create(:user, projects_limit: 0) }
+
+ it { is_expected.not_to be_allowed(:create_fork) }
+ end
+
+ context "when user is a master in a group" do
+ let(:group) { create(:group) }
+ let(:current_user) { create(:user, projects_limit: 0) }
+
+ before do
+ group.add_master(current_user)
+ end
+
+ it { is_expected.to be_allowed(:create_fork) }
+ end
+ end
+
describe 'custom attributes' do
context 'regular user' do
it { is_expected.not_to be_allowed(:read_custom_attribute) }