summaryrefslogtreecommitdiff
path: root/spec/factories/commit_statuses.rb
blob: 848a31e96c198d670a767de39b8daa308da611fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FactoryBot.define do
  factory :commit_status, class: CommitStatus do
    name 'default'
    stage 'test'
    stage_idx 0
    status 'success'
    description 'commit status'
    pipeline factory: :ci_pipeline_with_one_job
    started_at 'Tue, 26 Jan 2016 08:21:42 +0100'
    finished_at 'Tue, 26 Jan 2016 08:23:42 +0100'

    trait :success do
      status 'success'
    end

    trait :failed do
      status 'failed'
    end

    trait :canceled do
      status 'canceled'
    end

    trait :skipped do
      status 'skipped'
    end

    trait :running do
      status 'running'
    end

    trait :pending do
      status 'pending'
    end

    trait :preparing do
      status 'preparing'
    end

    trait :created do
      status 'created'
    end

    trait :manual do
      status 'manual'
    end

    trait :scheduled do
      status 'scheduled'
    end

    after(:build) do |build, evaluator|
      build.project = build.pipeline.project
    end

    factory :generic_commit_status, class: GenericCommitStatus do
      name 'generic'
      description 'external commit status'
    end
  end
end