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

import_state.rb « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 15d0a9d466af47477096fd301e356ddcd3c365bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FactoryBot.define do
  factory :import_state, class: ProjectImportState do
    status :none
    association :project, factory: :project

    transient do
      import_url { generate(:url) }
    end

    trait :repository do
      association :project, factory: [:project, :repository]
    end

    trait :none do
      status :none
    end

    trait :scheduled do
      status :scheduled
    end

    trait :started do
      status :started
    end

    trait :finished do
      status :finished
    end

    trait :failed do
      status :failed
    end

    after(:create) do |import_state, evaluator|
      import_state.project.update_columns(import_url: evaluator.import_url)
    end
  end
end