demarches-normaliennes/spec/factories/dossier.rb
Xavier J 27dbd3a878 Add auto champs objects at a dossier (same as PJ)
Add dynamic of Champs on the description page
Rename model 'Champs' to 'Champ'
2015-11-03 15:27:49 +01:00

28 lines
820 B
Ruby

FactoryGirl.define do
factory :dossier do
nom_projet "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger"
state 'draft'
trait :with_entreprise do
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|
procedure = create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champs)
dossier.procedure = procedure
end
end
trait :with_user do
after(:build) do |dossier, _evaluator|
dossier.user = create(:user)
end
end
end
end