diff --git a/app/controllers/administrateurs/types_de_champ_controller.rb b/app/controllers/administrateurs/types_de_champ_controller.rb index 158427102..a35621f19 100644 --- a/app/controllers/administrateurs/types_de_champ_controller.rb +++ b/app/controllers/administrateurs/types_de_champ_controller.rb @@ -32,11 +32,7 @@ module Administrateurs end def estimate_fill_duration - estimate = if @procedure.feature_enabled?(:procedure_estimated_fill_duration) - @procedure.draft_revision.estimated_fill_duration - else - 0 - end + estimate = @procedure.draft_revision.estimated_fill_duration render json: { estimated_fill_duration: estimate } end diff --git a/app/helpers/procedure_helper.rb b/app/helpers/procedure_helper.rb index 283a3a63b..bb855495e 100644 --- a/app/helpers/procedure_helper.rb +++ b/app/helpers/procedure_helper.rb @@ -38,7 +38,7 @@ module ProcedureHelper baseUrl: admin_procedure_types_de_champ_path(procedure), directUploadUrl: rails_direct_uploads_url, continuerUrl: admin_procedure_path(procedure), - estimatedFillDuration: procedure.feature_enabled?(:procedure_estimated_fill_duration) ? procedure.draft_revision.estimated_fill_duration : 0 + estimatedFillDuration: procedure.draft_revision.estimated_fill_duration } end diff --git a/app/views/shared/_procedure_description.html.haml b/app/views/shared/_procedure_description.html.haml index 266f97752..04d56263f 100644 --- a/app/views/shared/_procedure_description.html.haml +++ b/app/views/shared/_procedure_description.html.haml @@ -8,7 +8,7 @@ %h1.procedure-title = procedure.libelle -- if procedure.persisted? && procedure.feature_enabled?(:procedure_estimated_fill_duration) +- if procedure.persisted? %p.procedure-configuration.procedure-configuration--fill-duration %span.icon.clock = t('shared.procedure_description.estimated_fill_duration', estimated_minutes: estimated_fill_duration_minutes(procedure)) diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index c6d9a0c73..470fb81a9 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -26,7 +26,6 @@ features = [ :hide_instructeur_email, :procedure_revisions, :procedure_routage_api, - :procedure_estimated_fill_duration, :procedure_process_expired_dossiers_termine ] diff --git a/spec/system/administrateurs/types_de_champ_spec.rb b/spec/system/administrateurs/types_de_champ_spec.rb index d4de6fc1b..c35386b18 100644 --- a/spec/system/administrateurs/types_de_champ_spec.rb +++ b/spec/system/administrateurs/types_de_champ_spec.rb @@ -144,28 +144,23 @@ describe 'As an administrateur I can edit types de champ', js: true do expect(page).to have_content('Un menu') end - context "when the estimated fill duration is enabled" do - before { Flipper.enable(:procedure_estimated_fill_duration) } - after { Flipper.disable(:procedure_estimated_fill_duration) } + scenario "displaying the estimated fill duration" do + # It doesn't display anything when there are no champs + expect(page).not_to have_content('Durée de remplissage estimé') - scenario "displaying the estimated fill duration" do - # It doesn't display anything when there are no champs - expect(page).not_to have_content('Durée de remplissage estimé') + # It displays the estimate when adding a new champ + add_champ + select('Pièce justificative', from: 'champ-0-type_champ') + expect(page).to have_content('Durée de remplissage estimée : 1 mn') - # It displays the estimate when adding a new champ - add_champ - select('Pièce justificative', from: 'champ-0-type_champ') - expect(page).to have_content('Durée de remplissage estimée : 1 mn') + # It updates the estimate when updating the champ + check 'Obligatoire' + expect(page).to have_content('Durée de remplissage estimée : 3 mn') - # It updates the estimate when updating the champ - check 'Obligatoire' - expect(page).to have_content('Durée de remplissage estimée : 3 mn') - - # It updates the estimate when removing the champ - page.accept_alert do - click_on 'Supprimer' - end - expect(page).not_to have_content('Durée de remplissage estimée') + # It updates the estimate when removing the champ + page.accept_alert do + click_on 'Supprimer' end + expect(page).not_to have_content('Durée de remplissage estimée') end end diff --git a/spec/views/shared/_procedure_description.html.haml_spec.rb b/spec/views/shared/_procedure_description.html.haml_spec.rb index eff45327b..a01b11b8a 100644 --- a/spec/views/shared/_procedure_description.html.haml_spec.rb +++ b/spec/views/shared/_procedure_description.html.haml_spec.rb @@ -8,6 +8,7 @@ describe 'shared/_procedure_description.html.haml', type: :view do expect(rendered).to have_selector('.procedure-logos') expect(rendered).to have_text(procedure.libelle) expect(rendered).to have_text(procedure.description) + expect(rendered).to have_text('Temps de remplissage estimé') end it 'does not show empty date limite' do @@ -22,11 +23,4 @@ describe 'shared/_procedure_description.html.haml', type: :view do expect(rendered).to have_text('Date limite') end end - - context 'when the procedure_estimated_fill_duration feature is enabled' do - before { Flipper.enable(:procedure_estimated_fill_duration) } - after { Flipper.disable(:procedure_estimated_fill_duration) } - - it { is_expected.to have_text('Temps de remplissage estimé') } - end end