demarches-normaliennes/spec/factories/dossier.rb

47 lines
1.3 KiB
Ruby
Raw Normal View History

FactoryGirl.define do
factory :dossier do
2015-09-22 15:00:59 +02:00
nom_projet "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger"
description "Ma super description"
state 'draft'
2016-01-18 17:18:04 +01:00
association :user, factory:[:user]
trait :with_entreprise do
2015-08-20 16:25:54 +02:00
after(:build) do |dossier, _evaluator|
etablissement = create(:etablissement)
entreprise = create(:entreprise, etablissement: etablissement)
dossier.entreprise = entreprise
dossier.etablissement = etablissement
end
end
trait :with_procedure do
after(:build) do |dossier, _evaluator|
2015-11-05 11:21:44 +01:00
procedure = create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ)
dossier.procedure = procedure
end
end
2015-09-23 19:20:03 +02:00
trait :with_two_quartier_prioritaires do
after(:build) do |dossier, _evaluator|
qp1 = create(:quartier_prioritaire)
qp2 = create(:quartier_prioritaire)
dossier.quartier_prioritaires << qp1
dossier.quartier_prioritaires << qp2
end
end
2016-01-18 12:03:18 +01:00
trait :with_two_cadastres do
after(:build) do |dossier, _evaluator|
qp1 = create(:cadastre)
qp2 = create(:cadastre)
dossier.cadastres << qp1
dossier.cadastres << qp2
end
end
end
2015-08-20 17:30:17 +02:00
end