2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2015-11-05 05:03:02 -05:00
|
|
|
factory :release do
|
2022-03-16 20:07:59 -04:00
|
|
|
sequence :tag do |n|
|
|
|
|
"v1.#{n}.0"
|
|
|
|
end
|
2019-10-01 20:06:26 -04:00
|
|
|
sha { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
|
2018-12-12 04:56:43 -05:00
|
|
|
name { tag }
|
2019-10-01 20:06:26 -04:00
|
|
|
description { "Awesome release" }
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2018-12-13 06:08:53 -05:00
|
|
|
author
|
2019-07-03 05:12:15 -04:00
|
|
|
released_at { Time.zone.parse('2018-10-20T18:00:00Z') }
|
2018-12-25 04:48:26 -05:00
|
|
|
|
|
|
|
trait :legacy do
|
2019-10-01 20:06:26 -04:00
|
|
|
sha { nil }
|
2022-06-16 08:09:26 -04:00
|
|
|
|
|
|
|
# Legacy releases which are created during tags creation have empty users.
|
|
|
|
after(:create) do |release, _|
|
|
|
|
release.update_column(:author_id, nil)
|
|
|
|
end
|
2018-12-25 04:48:26 -05:00
|
|
|
end
|
2019-11-19 04:06:16 -05:00
|
|
|
|
|
|
|
trait :with_evidence do
|
|
|
|
after(:create) do |release, _|
|
|
|
|
create(:evidence, release: release)
|
|
|
|
end
|
|
|
|
end
|
2020-01-10 13:07:43 -05:00
|
|
|
|
|
|
|
trait :with_milestones do
|
|
|
|
transient do
|
|
|
|
milestones_count { 2 }
|
|
|
|
end
|
|
|
|
after(:create) do |release, evaluator|
|
|
|
|
create_list(:milestone, evaluator.milestones_count, project: evaluator.project, releases: [release])
|
|
|
|
end
|
|
|
|
end
|
2015-11-05 05:03:02 -05:00
|
|
|
end
|
|
|
|
end
|