demarches-normaliennes/spec/components/export_template/champs_component_spec.rb
Christophe Robillard ffd1a15d91
add, edit and destroy export template with exported_columns
Co-authored-by: mfo <mfo@users.noreply.github.com>
Co-authored-by: LeSim <mail@simon.lehericey.net>
2024-11-14 14:45:40 +01:00

26 lines
1.3 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
describe ExportTemplate::ChampsComponent, type: :component do
let(:groupe_instructeur) { create(:groupe_instructeur, procedure:) }
let(:export_template) { build(:export_template, kind: 'csv', groupe_instructeur:) }
let(:procedure) { create(:procedure_with_dossiers, :published, types_de_champ_public:, for_individual:) }
let(:for_individual) { true }
let(:types_de_champ_public) do
[
{ type: :text, libelle: "Ca va ?", mandatory: true, stable_id: 1 },
{ type: :communes, libelle: "Commune", mandatory: true, stable_id: 17 },
{ type: :siret, libelle: 'Siret', stable_id: 20 },
{ type: :repetition, mandatory: true, stable_id: 7, libelle: "Amis", children: [{ type: 'text', libelle: 'Prénom', stable_id: 8 }] }
]
end
let(:component) { described_class.new("Champs publics", export_template, procedure.all_revisions_types_de_champ(parent: nil, with_header_section: true)) }
before { render_inline(component).to_html }
it 'renders champs within fieldset' do
procedure
expect(page).to have_unchecked_field "Ca va ?"
expect(page).to have_unchecked_field "Commune"
expect(page).to have_unchecked_field "Siret"
expect(page).to have_unchecked_field "(Bloc répétable Amis) Prénom"
end
end