Remove carto from admin/procedure controller

This commit is contained in:
Paul Chavard 2018-11-27 15:59:09 +01:00
parent 1897b2775c
commit 575a437f97
2 changed files with 2 additions and 35 deletions

View file

@ -58,17 +58,11 @@ class Admin::ProceduresController < AdminController
def new def new
@procedure ||= Procedure.new @procedure ||= Procedure.new
@procedure.module_api_carto ||= ModuleAPICarto.new
@availability = Procedure::PATH_AVAILABLE @availability = Procedure::PATH_AVAILABLE
end end
def create def create
@procedure = Procedure.new(procedure_params) @procedure = Procedure.new(procedure_params)
if @procedure.valid?
@procedure.module_api_carto = ModuleAPICarto.new
end
@path = @procedure.path @path = @procedure.path
@availability = Procedure.path_availability(current_administrateur, @procedure.path) @availability = Procedure.path_availability(current_administrateur, @procedure.path)
@ -268,7 +262,7 @@ class Admin::ProceduresController < AdminController
if Flipflop.publish_draft? if Flipflop.publish_draft?
editable_params << :path editable_params << :path
end end
params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :individual_with_siret, :ask_birthday, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id) params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :individual_with_siret, :ask_birthday).merge(administrateur_id: current_administrateur.id)
end end
end end
end end

View file

@ -12,9 +12,6 @@ describe Admin::ProceduresController, type: :controller do
let(:organisation) { 'Organisation de test' } let(:organisation) { 'Organisation de test' }
let(:direction) { 'Direction de test' } let(:direction) { 'Direction de test' }
let(:cadre_juridique) { 'cadre juridique' } let(:cadre_juridique) { 'cadre juridique' }
let(:use_api_carto) { '0' }
let(:quartiers_prioritaires) { '0' }
let(:cadastre) { '0' }
let(:duree_conservation_dossiers_dans_ds) { 3 } let(:duree_conservation_dossiers_dans_ds) { 3 }
let(:duree_conservation_dossiers_hors_ds) { 6 } let(:duree_conservation_dossiers_hors_ds) { 6 }
@ -27,12 +24,7 @@ describe Admin::ProceduresController, type: :controller do
direction: direction, direction: direction,
cadre_juridique: cadre_juridique, cadre_juridique: cadre_juridique,
duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds, duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds,
duree_conservation_dossiers_hors_ds: duree_conservation_dossiers_hors_ds, duree_conservation_dossiers_hors_ds: duree_conservation_dossiers_hors_ds
module_api_carto_attributes: {
use_api_carto: use_api_carto,
quartiers_prioritaires: quartiers_prioritaires,
cadastre: cadastre
}
} }
} }
@ -255,8 +247,6 @@ describe Admin::ProceduresController, type: :controller do
let(:description) { 'blabla' } let(:description) { 'blabla' }
let(:organisation) { 'plop' } let(:organisation) { 'plop' }
let(:direction) { 'plap' } let(:direction) { 'plap' }
let(:use_api_carto) { '1' }
let(:cadastre) { '1' }
let(:duree_conservation_dossiers_dans_ds) { 7 } let(:duree_conservation_dossiers_dans_ds) { 7 }
let(:duree_conservation_dossiers_hors_ds) { 5 } let(:duree_conservation_dossiers_hors_ds) { 5 }
@ -273,14 +263,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.duree_conservation_dossiers_hors_ds).to eq(duree_conservation_dossiers_hors_ds) } it { expect(subject.duree_conservation_dossiers_hors_ds).to eq(duree_conservation_dossiers_hors_ds) }
end end
describe 'procedure module api carto attributs in database' do
subject { procedure.module_api_carto }
it { expect(subject.use_api_carto).to be_truthy }
it { expect(subject.quartiers_prioritaires).to be_falsey }
it { expect(subject.cadastre).to be_truthy }
end
it { is_expected.to redirect_to(edit_admin_procedure_path id: procedure.id) } it { is_expected.to redirect_to(edit_admin_procedure_path id: procedure.id) }
it { expect(flash[:notice]).to be_present } it { expect(flash[:notice]).to be_present }
end end
@ -293,14 +275,6 @@ describe Admin::ProceduresController, type: :controller do
describe 'flash message is present' do describe 'flash message is present' do
it { expect(flash[:alert]).to be_present } it { expect(flash[:alert]).to be_present }
end end
describe 'procedure module api carto attributs in database' do
subject { procedure.module_api_carto }
it { expect(subject.use_api_carto).to be_falsey }
it { expect(subject.quartiers_prioritaires).to be_falsey }
it { expect(subject.cadastre).to be_falsey }
end
end end
context 'when procedure is brouillon' do context 'when procedure is brouillon' do
@ -334,7 +308,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] } it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] }
it { expect(subject.individual_with_siret).not_to eq procedure_params[:individual_with_siret] } it { expect(subject.individual_with_siret).not_to eq procedure_params[:individual_with_siret] }
it { expect(subject.use_legacy_carto?).not_to eq procedure_params[:module_api_carto_attributes][:use_api_carto] }
end end
end end
end end