add a label for api and export for sensitive data as titre_identite_champ

This commit is contained in:
Lisa Durand 2022-11-08 16:46:57 +01:00 committed by Paul Chavard
parent c200e03771
commit f34c890278
2 changed files with 29 additions and 2 deletions

View file

@ -37,10 +37,10 @@ class Champs::TitreIdentiteChamp < Champ
end end
def for_export def for_export
nil piece_justificative_file.attached? ? "présent" : "absent"
end end
def for_api def for_api
nil piece_justificative_file.attached? ? "présent" : "absent"
end end
end end

View file

@ -0,0 +1,27 @@
describe Champs::TitreIdentiteChamp do
describe "#for_export" do
let(:champ_titre_identite) { create(:champ_titre_identite) }
subject { champ_titre_identite.for_export }
it { is_expected.to eq('présent') }
context 'without attached file' do
before { champ_titre_identite.piece_justificative_file.purge }
it { is_expected.to eq('absent') }
end
end
describe '#for_api' do
let(:champ_titre_identite) { create(:champ_titre_identite) }
subject { champ_titre_identite.for_api }
it { is_expected.to eq('présent') }
context 'without attached file' do
before { champ_titre_identite.piece_justificative_file.purge }
it { is_expected.to eq('absent') }
end
end
end