debian-mirror-gitlab/spec/factories/protected_branches.rb

30 lines
885 B
Ruby
Raw Normal View History

2016-06-02 11:05:42 +05:30
FactoryGirl.define do
factory :protected_branch do
name
project
2016-09-13 17:45:13 +05:30
after(:build) do |protected_branch|
protected_branch.push_access_levels.new(access_level: Gitlab::Access::MASTER)
protected_branch.merge_access_levels.new(access_level: Gitlab::Access::MASTER)
end
trait :developers_can_push do
after(:create) do |protected_branch|
protected_branch.push_access_levels.first.update!(access_level: Gitlab::Access::DEVELOPER)
end
end
trait :developers_can_merge do
after(:create) do |protected_branch|
protected_branch.merge_access_levels.first.update!(access_level: Gitlab::Access::DEVELOPER)
end
end
trait :no_one_can_push do
after(:create) do |protected_branch|
protected_branch.push_access_levels.first.update!(access_level: Gitlab::Access::NO_ACCESS)
end
end
2016-06-02 11:05:42 +05:30
end
end