debian-mirror-gitlab/spec/factories/design_management/design_at_version.rb
2021-01-30 21:13:34 +05:30

23 lines
539 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :design_at_version, class: 'DesignManagement::DesignAtVersion' do
skip_create # This is not an Active::Record model.
design { nil }
version { nil }
transient do
issue { design&.issue || version&.issue || association(:issue) }
end
initialize_with do
attrs = attributes.dup
attrs[:design] ||= association(:design, issue: issue)
attrs[:version] ||= association(:design_version, issue: issue)
new(attrs)
end
end
end