correctif(api/v1): ajoute la methode manquante for_api sur le type de champs departement
This commit is contained in:
parent
3732c079a7
commit
48c80e9387
3 changed files with 26 additions and 0 deletions
|
@ -33,6 +33,10 @@ class Champs::DepartementChamp < Champs::TextChamp
|
|||
formatted_value
|
||||
end
|
||||
|
||||
def for_api
|
||||
formatted_value
|
||||
end
|
||||
|
||||
def selected
|
||||
code
|
||||
end
|
||||
|
|
|
@ -120,6 +120,10 @@ describe API::V1::DossiersController do
|
|||
end
|
||||
|
||||
describe 'GET show' do
|
||||
before do
|
||||
allow(APIGeoService).to receive(:departement_name).with('01').and_return('Ain')
|
||||
end
|
||||
|
||||
let(:retour) { get :show, params: { token: token, procedure_id: procedure_id, id: dossier_id } }
|
||||
subject { retour }
|
||||
|
||||
|
@ -254,6 +258,18 @@ describe API::V1::DossiersController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'departement' do
|
||||
let(:procedure) { create(:procedure, :with_departement, administrateur: admin) }
|
||||
let(:dossier) { create(:dossier, :en_construction, :with_populated_champs, procedure: procedure) }
|
||||
|
||||
subject { super() }
|
||||
|
||||
it 'should have rows' do
|
||||
expect(subject.size).to eq(1)
|
||||
expect(subject.first[:value]).to eq("01 – Ain")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'repetition' do
|
||||
let(:procedure) { create(:procedure, :with_repetition, administrateur: admin) }
|
||||
let(:dossier) { create(:dossier, :en_construction, :with_populated_champs, procedure: procedure) }
|
||||
|
|
|
@ -199,6 +199,12 @@ FactoryBot.define do
|
|||
end
|
||||
end
|
||||
|
||||
trait :with_departement do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
build(:type_de_champ_departements, procedure: procedure)
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_piece_justificative do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
build(:type_de_champ_piece_justificative, procedure: procedure)
|
||||
|
|
Loading…
Reference in a new issue