diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-07-08 11:45:02 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-07-29 15:20:39 +0530 |
commit | 828f6eb6e50e6193fad9dbdd95d9dd56506e4064 (patch) | |
tree | 9a328d1698606d81c0bb7000ed68a4d01891f3f0 /spec/factories/protected_branches.rb | |
parent | ab6096c17261605d835a4a8edae21f31d90026df (diff) | |
download | gitlab-ce-828f6eb6e50e6193fad9dbdd95d9dd56506e4064.tar.gz |
Enforce "No One Can Push" during git operations.
1. The crux of this change is in `UserAccess`, which looks through all
the access levels, asking each if the user has access to push/merge
for the current project.
2. Update the `protected_branches` factory to create access levels as
necessary.
3. Fix and augment `user_access` and `git_access` specs.
Diffstat (limited to 'spec/factories/protected_branches.rb')
-rw-r--r-- | spec/factories/protected_branches.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/factories/protected_branches.rb b/spec/factories/protected_branches.rb index 28ed8078157..24a9b78f0c2 100644 --- a/spec/factories/protected_branches.rb +++ b/spec/factories/protected_branches.rb @@ -2,5 +2,22 @@ FactoryGirl.define do factory :protected_branch do name project + + after(:create) do |protected_branch| + protected_branch.create_push_access_level!(access_level: :masters) + protected_branch.create_merge_access_level!(access_level: :masters) + end + + trait :developers_can_push do + after(:create) { |protected_branch| protected_branch.push_access_level.developers! } + end + + trait :developers_can_merge do + after(:create) { |protected_branch| protected_branch.merge_access_level.developers! } + end + + trait :no_one_can_push do + after(:create) { |protected_branch| protected_branch.push_access_level.no_one! } + end end end |