2018-01-23 17:15:42 +01:00
|
|
|
FactoryBot.define do
|
2016-06-09 12:08:18 +02:00
|
|
|
factory :champ do
|
2018-02-14 15:12:57 +01:00
|
|
|
type_de_champ { create(:type_de_champ) }
|
2017-07-11 16:50:29 +02:00
|
|
|
|
|
|
|
trait :checkbox do
|
2018-02-14 15:12:57 +01:00
|
|
|
type_de_champ { create(:type_de_champ_checkbox) }
|
2017-07-11 16:50:29 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :header_section do
|
2018-02-14 15:12:57 +01:00
|
|
|
type_de_champ { create(:type_de_champ_header_section) }
|
2017-07-11 16:50:29 +02:00
|
|
|
end
|
2017-10-03 15:08:39 +02:00
|
|
|
|
|
|
|
trait :explication do
|
2018-02-14 15:12:57 +01:00
|
|
|
type_de_champ { create(:type_de_champ_explication) }
|
2017-10-03 15:08:39 +02:00
|
|
|
end
|
2017-11-21 17:20:52 +01:00
|
|
|
|
|
|
|
trait :dossier_link do
|
2018-02-14 15:12:57 +01:00
|
|
|
type_de_champ { create(:type_de_champ_dossier_link) }
|
2017-11-21 17:20:52 +01:00
|
|
|
end
|
2018-05-11 14:59:20 +02:00
|
|
|
|
|
|
|
trait :piece_justificative do
|
|
|
|
type_de_champ { create(:type_de_champ_piece_justificative) }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :with_piece_justificative_file do
|
|
|
|
after(:create) do |champ, evaluator|
|
|
|
|
champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain")
|
|
|
|
end
|
|
|
|
end
|
2016-06-09 12:08:18 +02:00
|
|
|
end
|
2018-11-13 18:48:04 +01:00
|
|
|
|
|
|
|
factory :champ_integer_number, class: 'Champs::IntegerNumberChamp' do
|
|
|
|
type_de_champ { create(:type_de_champ_integer_number) }
|
|
|
|
value { '42' }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :champ_decimal_number, class: 'Champs::DecimalNumberChamp' do
|
|
|
|
type_de_champ { create(:type_de_champ_decimal_number) }
|
|
|
|
value { '42.1' }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :champ_linked_drop_down_list, class: 'Champs::LinkedDropDownListChamp' do
|
|
|
|
type_de_champ { create(:type_de_champ_linked_drop_down_list) }
|
|
|
|
value { '{}' }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :champ_carte, class: 'Champs::CarteChamp' do
|
|
|
|
type_de_champ { create(:type_de_champ_carte) }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :champ_siret, class: 'Champs::SiretChamp' do
|
|
|
|
type_de_champ { create(:type_de_champ_siret) }
|
|
|
|
value { '44011762001530' }
|
|
|
|
etablissement { create(:etablissement) }
|
|
|
|
|
|
|
|
before(:create) do |champ, evaluator|
|
|
|
|
champ.etablissement.signature = champ.etablissement.sign
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :champ_piece_justificative, class: 'Champs::PieceJustificativeChamp' do
|
|
|
|
type_de_champ { create(:type_de_champ_piece_justificative) }
|
|
|
|
|
|
|
|
after(:create) do |champ, evaluator|
|
|
|
|
champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain")
|
|
|
|
end
|
|
|
|
end
|
2016-06-09 12:08:18 +02:00
|
|
|
end
|