summaryrefslogtreecommitdiff
path: root/spec/factories/ci/ref.rb
blob: 891d8848a726d27427d71d4869111fd6152b82d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

FactoryBot.define do
  factory :ci_ref, class: 'Ci::Ref' do
    ref { 'master' }
    status { :success }
    tag { false }
    project

    before(:create) do |ref, evaluator|
      next if ref.pipelines.exists?

      ref.update!(last_updated_by_pipeline: create(:ci_pipeline, project: evaluator.project, ref: evaluator.ref, tag: evaluator.tag, status: evaluator.status))
    end
  end
end