2015-08-13 15:55:19 +02:00
|
|
|
FactoryGirl.define do
|
|
|
|
factory :dossier do
|
2015-09-24 10:17:59 +02:00
|
|
|
state 'draft'
|
2016-02-04 14:08:35 +01:00
|
|
|
association :user, factory: [:user]
|
|
|
|
|
|
|
|
before(:create) do |dossier, _evaluator|
|
|
|
|
unless dossier.procedure
|
2016-08-08 12:52:30 +02:00
|
|
|
procedure = create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private)
|
2016-02-02 18:37:38 +01:00
|
|
|
dossier.procedure = procedure
|
|
|
|
end
|
|
|
|
end
|
2016-02-04 14:08:35 +01:00
|
|
|
|
2015-08-13 15:55:19 +02:00
|
|
|
trait :with_entreprise do
|
2015-08-20 16:25:54 +02:00
|
|
|
after(:build) do |dossier, _evaluator|
|
2015-08-13 15:55:19 +02:00
|
|
|
etablissement = create(:etablissement)
|
|
|
|
entreprise = create(:entreprise, etablissement: etablissement)
|
|
|
|
dossier.entreprise = entreprise
|
|
|
|
dossier.etablissement = etablissement
|
|
|
|
end
|
|
|
|
end
|
2015-09-21 17:59:03 +02:00
|
|
|
|
2017-01-03 12:53:27 +01:00
|
|
|
trait :for_individual do
|
|
|
|
after(:build) do |dossier, _evaluator|
|
|
|
|
dossier.individual = create :individual
|
|
|
|
dossier.save
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-11-25 17:05:14 +01:00
|
|
|
trait :with_two_quartier_prioritaires do
|
|
|
|
after(:build) do |dossier, _evaluator|
|
2016-03-16 15:34:35 +01:00
|
|
|
dossier.quartier_prioritaires << create(:quartier_prioritaire)
|
|
|
|
dossier.quartier_prioritaires << create(:quartier_prioritaire)
|
2015-11-25 17:05:14 +01:00
|
|
|
end
|
|
|
|
end
|
2016-01-18 12:03:18 +01:00
|
|
|
|
|
|
|
trait :with_two_cadastres do
|
|
|
|
after(:build) do |dossier, _evaluator|
|
2016-03-16 15:34:35 +01:00
|
|
|
dossier.cadastres << create(:cadastre)
|
|
|
|
dossier.cadastres << create(:cadastre)
|
|
|
|
end
|
|
|
|
end
|
2016-01-18 12:03:18 +01:00
|
|
|
|
2016-03-16 15:34:35 +01:00
|
|
|
trait :with_cerfa_upload do
|
|
|
|
after(:build) do |dossier, _evaluator|
|
2016-01-18 12:03:18 +01:00
|
|
|
|
2016-03-16 15:34:35 +01:00
|
|
|
dossier.cerfa << create(:cerfa)
|
2016-01-18 12:03:18 +01:00
|
|
|
end
|
|
|
|
end
|
2015-08-13 15:55:19 +02:00
|
|
|
end
|
2015-08-20 17:30:17 +02:00
|
|
|
end
|