From cdceddafe1b01f44cfbdbec4b505dbaa4fa73efe Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Thu, 14 Nov 2024 08:59:38 +0000 Subject: [PATCH] Fixe les tests --- spec/helpers/navigation_helper_spec.rb | 65 ++++++++++++++++++++ spec/system/instructeurs/instruction_spec.rb | 3 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 spec/helpers/navigation_helper_spec.rb diff --git a/spec/helpers/navigation_helper_spec.rb b/spec/helpers/navigation_helper_spec.rb new file mode 100644 index 000000000..b7289e445 --- /dev/null +++ b/spec/helpers/navigation_helper_spec.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +RSpec.describe NavigationHelper do + describe '#current_nav_section' do + subject { helper.current_nav_section } + + context 'when in procedure management section' do + it 'returns procedure_management for administrateurs action' do + allow(helper).to receive(:params).and_return({ action: 'administrateurs' }) + expect(subject).to eq('procedure_management') + end + + it 'returns procedure_management for stats action' do + allow(helper).to receive(:params).and_return({ action: 'stats' }) + expect(subject).to eq('procedure_management') + end + + it 'returns procedure_management for email_notifications action' do + allow(helper).to receive(:params).and_return({ action: 'email_notifications' }) + expect(subject).to eq('procedure_management') + end + + it 'returns procedure_management for deleted_dossiers action' do + allow(helper).to receive(:params).and_return({ action: 'deleted_dossiers' }) + expect(subject).to eq('procedure_management') + end + + it 'returns procedure_management for groupe_instructeurs controller' do + allow(helper).to receive(:params).and_return({ controller: 'instructeurs/groupe_instructeurs' }) + expect(subject).to eq('procedure_management') + end + end + + context 'when in user support section' do + it 'returns user_support for email_usagers action' do + allow(helper).to receive(:params).and_return({ action: 'email_usagers' }) + expect(subject).to eq('user_support') + end + + it 'returns user_support for apercu action' do + allow(helper).to receive(:params).and_return({ action: 'apercu' }) + expect(subject).to eq('user_support') + end + end + + context 'when in downloads section' do + it 'returns downloads for exports action' do + allow(helper).to receive(:params).and_return({ action: 'exports' }) + expect(subject).to eq('downloads') + end + + it 'returns downloads for archives controller' do + allow(helper).to receive(:params).and_return({ controller: 'instructeurs/archives' }) + expect(subject).to eq('downloads') + end + end + + context 'when in no specific section' do + it 'returns follow_up by default' do + allow(helper).to receive(:params).and_return({ action: 'show', controller: 'procedures' }) + expect(subject).to eq('follow_up') + end + end + end +end diff --git a/spec/system/instructeurs/instruction_spec.rb b/spec/system/instructeurs/instruction_spec.rb index bfd9447d2..5e06cd74f 100644 --- a/spec/system/instructeurs/instruction_spec.rb +++ b/spec/system/instructeurs/instruction_spec.rb @@ -139,7 +139,8 @@ describe 'Instructing a dossier:', js: true do expect(page).to have_text('Nous générons cet export.') - click_on "Voir les exports et modèles d'export" + find("button", text: "Téléchargements").click + click_on "Liste des exports" expect(page).to have_text("Export .csv d’un dossier « à suivre » demandé il y a moins d'une minute") expect(page).to have_text("En préparation")