summaryrefslogtreecommitdiff
path: root/spec/factories/deploy_tokens.rb
blob: 017e866e69c7692aa672de6adb7ea997727d3004 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FactoryBot.define do
  factory :deploy_token do
    token { SecureRandom.hex(50) }
    sequence(:name) { |n| "PDT #{n}" }
    read_repository true
    read_registry true
    revoked false
    expires_at { 5.days.from_now }

    trait :revoked do
      revoked true
    end

    trait :gitlab_deploy_token do
      name DeployToken::GITLAB_DEPLOY_TOKEN_NAME
    end

    trait :expired do
      expires_at { Date.today - 1.month }
    end
  end
end