protected_branches.rb 677 Bytes
Newer Older
1 2 3 4
FactoryGirl.define do
  factory :protected_branch do
    name
    project
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    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
22 23
  end
end