2016-02-17 03:55:24 +00:00
|
|
|
FactoryGirl.define do
|
|
|
|
factory :protected_branch do
|
|
|
|
name
|
|
|
|
project
|
2016-07-08 06:15:02 +00:00
|
|
|
|
|
|
|
after(:create) do |protected_branch|
|
2016-07-29 06:13:07 +00:00
|
|
|
protected_branch.create_push_access_level!(access_level: Gitlab::Access::MASTER)
|
|
|
|
protected_branch.create_merge_access_level!(access_level: Gitlab::Access::MASTER)
|
2016-07-08 06:15:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :developers_can_push do
|
2016-07-29 06:13:07 +00:00
|
|
|
after(:create) do |protected_branch|
|
|
|
|
protected_branch.push_access_level.update!(access_level: Gitlab::Access::DEVELOPER)
|
|
|
|
end
|
2016-07-08 06:15:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :developers_can_merge do
|
2016-07-29 06:13:07 +00:00
|
|
|
after(:create) do |protected_branch|
|
|
|
|
protected_branch.merge_access_level.update!(access_level: Gitlab::Access::DEVELOPER)
|
|
|
|
end
|
2016-07-08 06:15:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :no_one_can_push do
|
2016-07-29 06:13:07 +00:00
|
|
|
after(:create) do |protected_branch|
|
|
|
|
protected_branch.push_access_level.update!(access_level: Gitlab::Access::NO_ACCESS)
|
|
|
|
end
|
2016-07-08 06:15:02 +00:00
|
|
|
end
|
2016-02-17 03:55:24 +00:00
|
|
|
end
|
|
|
|
end
|