add a label for api and export for sensitive data as titre_identite_champ
This commit is contained in:
parent
c200e03771
commit
f34c890278
2 changed files with 29 additions and 2 deletions
|
@ -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
|
||||||
|
|
27
spec/models/champs/titre_identite_champ_spec.rb
Normal file
27
spec/models/champs/titre_identite_champ_spec.rb
Normal 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
|
Loading…
Reference in a new issue