103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/ductwork/testing/rspec.rb', line 103
def pipeline_for(klass, **attrs)
definition = klass.pipeline_definition.to_json
definition_sha1 = Digest::SHA1.hexdigest(definition)
pipeline_klass = klass.name.to_s
now = Time.current
status = attrs[:status] || "in_progress"
triggered_at = attrs[:triggered_at] || now
started_at = attrs[:started_at] || now
pipeline = Ductwork::Pipeline.create!(klass:, status:)
pipeline.runs.create!(
pipeline_klass:,
definition:,
definition_sha1:,
status:,
triggered_at:,
started_at:
)
pipeline
end
|