summaryrefslogtreecommitdiff
path: root/spec/factories/protected_branches.rb
blob: 24a9b78f0c2d6016fe9ef907b63ce82feaa4fcb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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