Welcome to mirror list, hosted at ThFree Co, Russian Federation.

protected_tags.rb « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8e90ae1ee12ae25fc528fe546b20d8c9200096f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FactoryGirl.define do
  factory :protected_tag do
    name
    project

    after(:build) do |protected_tag|
      protected_tag.create_access_levels.new(access_level: Gitlab::Access::MASTER)
    end

    trait :developers_can_create do
      after(:create) do |protected_tag|
        protected_tag.create_access_levels.first.update!(access_level: Gitlab::Access::DEVELOPER)
      end
    end

    trait :no_one_can_create do
      after(:create) do |protected_tag|
        protected_tag.create_access_levels.first.update!(access_level: Gitlab::Access::NO_ACCESS)
      end
    end
  end
end