Welcome to mirror list, hosted at ThFree Co, Russian Federation.

design_at_version.rb « design_management « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3d85269ee27ac90e30cce69cb0eb3eea356cab27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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