summaryrefslogtreecommitdiff
path: root/spec/factories/ci/test_case.rb
blob: dc0e7c762ab0b70acd2be41739a289d61e16f3c7 (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
# frozen_string_literal: true

FactoryBot.define do
  factory :test_case, class: 'Gitlab::Ci::Reports::TestCase' do
    name { "test-1" }
    classname { "trace" }
    file { "spec/trace_spec.rb" }
    execution_time { 1.23 }
    status { "success" }
    system_output { nil }
    attachment { nil }
    association :job, factory: :ci_build

    trait :failed do
      status { "failed" }
    end

    trait :with_attachment do
      status { "failed" }
      attachment { "some/path.png" }
    end

    skip_create

    initialize_with do
      new(
        name: name,
        classname: classname,
        file: file,
        execution_time: execution_time,
        status: status,
        system_output: system_output,
        attachment: attachment,
        job: job
      )
    end
  end
end