feat(export.user): add when user passthru FranceConnect or not

This commit is contained in:
Martin 2024-02-19 16:59:09 +01:00 committed by mfo
parent c9235c8a3d
commit c2675dfb4d
2 changed files with 12 additions and 1 deletions

View file

@ -1192,7 +1192,8 @@ class Dossier < ApplicationRecord
def spreadsheet_columns(with_etablissement: false, types_de_champ:)
columns = [
['ID', id.to_s],
['Email', user_email_for(:display)]
['Email', user_email_for(:display)],
['FranceConnect ?', user.france_connect_information.present?]
]
if procedure.for_individual?

View file

@ -2126,6 +2126,16 @@ describe Dossier, type: :model do
describe "#spreadsheet_columns" do
let(:dossier) { create(:dossier) }
context 'user france connected' do
let(:dossier) { build(:dossier, user: build(:user, france_connect_information: build(:france_connect_information))) }
it { expect(dossier.spreadsheet_columns(types_de_champ: [])).to include(["FranceConnect ?", true]) }
end
context 'user not france connected' do
let(:dossier) { build(:dossier) }
it { expect(dossier.spreadsheet_columns(types_de_champ: [])).to include(["FranceConnect ?", false]) }
end
context 'for_individual' do
let(:dossier) { create(:dossier, procedure: create(:procedure, :for_individual)) }
it { expect(dossier.spreadsheet_columns(types_de_champ: [])).to include(["Dépot pour un tier", :for_tiers]) }