2016-02-16 22:55:24 -05:00
|
|
|
FactoryGirl.define do
|
|
|
|
factory :protected_branch do
|
|
|
|
name
|
|
|
|
project
|
2016-07-08 02:15:02 -04:00
|
|
|
|
2016-08-16 04:04:56 -04:00
|
|
|
after(:build) do |protected_branch|
|
2016-08-16 03:15:48 -04:00
|
|
|
protected_branch.push_access_levels.new(access_level: Gitlab::Access::MASTER)
|
|
|
|
protected_branch.merge_access_levels.new(access_level: Gitlab::Access::MASTER)
|
2016-07-08 02:15:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :developers_can_push do
|
2016-07-29 02:13:07 -04:00
|
|
|
after(:create) do |protected_branch|
|
2016-08-16 01:09:13 -04:00
|
|
|
protected_branch.push_access_levels.first.update!(access_level: Gitlab::Access::DEVELOPER)
|
2016-07-29 02:13:07 -04:00
|
|
|
end
|
2016-07-08 02:15:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :developers_can_merge do
|
2016-07-29 02:13:07 -04:00
|
|
|
after(:create) do |protected_branch|
|
2016-08-16 01:09:13 -04:00
|
|
|
protected_branch.merge_access_levels.first.update!(access_level: Gitlab::Access::DEVELOPER)
|
2016-07-29 02:13:07 -04:00
|
|
|
end
|
2016-07-08 02:15:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :no_one_can_push do
|
2016-07-29 02:13:07 -04:00
|
|
|
after(:create) do |protected_branch|
|
2016-08-16 01:09:13 -04:00
|
|
|
protected_branch.push_access_levels.first.update!(access_level: Gitlab::Access::NO_ACCESS)
|
2016-07-29 02:13:07 -04:00
|
|
|
end
|
2016-07-08 02:15:02 -04:00
|
|
|
end
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|
|
|
|
end
|