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

FactoryBot.define do
  factory :ci_build_report_result, class: 'Ci::BuildReportResult' do
    build factory: :ci_build
    project factory: :project

    transient do
      test_suite_name { "rspec" }
    end

    data do
      {
        tests: {
          name: test_suite_name,
          duration: 0.42,
          failed: 0,
          errored: 2,
          skipped: 0,
          success: 0
        }
      }
    end

    trait :with_junit_success do
      data do
        {
          tests: {
            name: test_suite_name,
            duration: 0.42,
            failed: 0,
            errored: 0,
            skipped: 0,
            success: 2
          }
        }
      end
    end

    trait :with_junit_suite_error do
      transient do
        test_suite_error { "some error" }
      end

      data do
        {
          tests: {
            name: test_suite_name,
            duration: 0.42,
            failed: 0,
            errored: 0,
            skipped: 0,
            success: 2,
            suite_error: test_suite_error
          }
        }
      end
    end
  end
end