2020-03-27 08:07:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :terraform_state, class: 'Terraform::State' do
|
2020-10-23 02:08:51 -04:00
|
|
|
project { association(:project) }
|
2020-03-27 08:07:43 -04:00
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
sequence(:name) { |n| "state-#{n}" }
|
|
|
|
|
2020-07-14 02:09:17 -04:00
|
|
|
trait :locked do
|
|
|
|
sequence(:lock_xid) { |n| "lock-#{n}" }
|
|
|
|
locked_at { Time.current }
|
2020-10-23 02:08:51 -04:00
|
|
|
locked_by_user { association(:user) }
|
2020-07-14 02:09:17 -04:00
|
|
|
end
|
2020-08-27 17:10:27 -04:00
|
|
|
|
2022-06-02 23:09:20 -04:00
|
|
|
trait :deletion_in_progress do
|
|
|
|
deleted_at { Time.current }
|
|
|
|
end
|
|
|
|
|
2020-09-16 08:10:15 -04:00
|
|
|
trait :with_version do
|
|
|
|
after(:create) do |state|
|
2020-10-29 14:09:11 -04:00
|
|
|
create(:terraform_state_version, terraform_state: state)
|
2020-09-16 08:10:15 -04:00
|
|
|
end
|
|
|
|
end
|
2020-03-27 08:07:43 -04:00
|
|
|
end
|
|
|
|
end
|