summaryrefslogtreecommitdiff
path: root/spec/factories/ci/ref.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/ci/ref.rb')
-rw-r--r--spec/factories/ci/ref.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/factories/ci/ref.rb b/spec/factories/ci/ref.rb
new file mode 100644
index 00000000000..891d8848a72
--- /dev/null
+++ b/spec/factories/ci/ref.rb
@@ -0,0 +1,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