demarches-normaliennes/spec/factories/zone.rb

18 lines
472 B
Ruby
Raw Normal View History

# frozen_string_literal: true
FactoryBot.define do
factory :zone do
sequence(:acronym) { |n| "MA#{n}" }
tchap_hs { ['agent.educpop.tchap.gouv.fr'] }
2022-08-11 19:05:12 +02:00
transient do
labels { [{ designated_on: '1981-05-08', name: "Ministère de l'Education Populaire" }] }
end
after(:build) do |zone, evaluator|
2022-08-11 19:05:12 +02:00
evaluator.labels.each do |label|
zone.labels.build(designated_on: label[:designated_on], name: label[:name])
2022-08-11 19:05:12 +02:00
end
end
end
end