Merge pull request #7277 from betagouv/fix-disabled-unit-tests
Expert : amélioration de l'en-tête des pages d'avis
This commit is contained in:
commit
fd9f480083
4 changed files with 45 additions and 42 deletions
|
@ -1,15 +1,17 @@
|
|||
.sub-header
|
||||
.container
|
||||
%ul.breadcrumbs
|
||||
%li= link_to('Avis', expert_all_avis_path)
|
||||
%li= link_to(dossier.procedure.libelle, procedure_expert_avis_index_path(avis.procedure))
|
||||
%li= link_to("Dossier nº #{dossier.id}", expert_avis_path(avis.procedure, avis))
|
||||
.flex.justify-between
|
||||
%ul.breadcrumbs
|
||||
%li= link_to('Avis', expert_all_avis_path)
|
||||
%li= link_to(dossier.procedure.libelle.truncate_words(10), procedure_expert_avis_index_path(avis.procedure))
|
||||
%li= link_to("Dossier nº #{dossier.id}", expert_avis_path(avis.procedure, avis))
|
||||
|
||||
%span.dropdown.print-menu-opener
|
||||
%button.button.dropdown-button.icon-only{ 'aria-expanded' => 'false', 'aria-controls' => 'print-pj-menu' }
|
||||
%span.icon.attached
|
||||
%ul#print-pj-menu.print-menu.dropdown-content
|
||||
%li= link_to "Télécharger le dossier et toutes ses pièces jointes", telecharger_pjs_expert_avis_path(avis), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
||||
.header-actions
|
||||
%span.dropdown.print-menu-opener
|
||||
%button.button.dropdown-button.icon-only{ 'aria-expanded' => 'false', 'aria-controls' => 'print-pj-menu' }
|
||||
%span.icon.attached
|
||||
%ul.print-menu.dropdown-content
|
||||
%li= link_to "Télécharger le dossier et toutes ses pièces jointes", telecharger_pjs_expert_avis_path(avis.procedure, avis), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
||||
|
||||
%nav.tabs
|
||||
%ul
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
describe 'experts/avis/index.html.haml', type: :view do
|
||||
let!(:expert) { create(:expert) }
|
||||
let!(:claimant) { create(:instructeur) }
|
||||
let!(:procedure) { create(:procedure) }
|
||||
let!(:avis) { create(:avis, claimant: claimant, experts_procedure: experts_procedure) }
|
||||
let!(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: procedure) }
|
||||
|
||||
before do
|
||||
allow(view).to receive(:current_expert).and_return(avis.expert)
|
||||
assign(:dossier, avis.dossier)
|
||||
allow(view).to receive(:current_expert).and_return(avis.expert)
|
||||
end
|
||||
|
||||
subject { render }
|
||||
|
||||
context 'when the dossier is deleted by instructeur' do
|
||||
before do
|
||||
avis.dossier.update!(state: "accepte", hidden_by_administration_at: Time.zone.now.beginning_of_day.utc)
|
||||
assign(:avis_by_procedure, avis.expert.avis.includes(dossier: [groupe_instructeur: :procedure]).where(dossiers: { hidden_by_administration_at: nil }).to_a.group_by(&:procedure))
|
||||
end
|
||||
it { is_expected.not_to have_text("avis à donner") }
|
||||
end
|
||||
|
||||
context 'when the dossier is not deleted by instructeur' do
|
||||
before do
|
||||
assign(:avis_by_procedure, avis.expert.avis.includes(dossier: [groupe_instructeur: :procedure]).where(dossiers: { hidden_by_administration_at: nil }).to_a.group_by(&:procedure))
|
||||
end
|
||||
it { is_expected.to have_text("avis à donner") }
|
||||
end
|
||||
end
|
31
spec/views/experts/avis/index.html.haml_spec.rb
Normal file
31
spec/views/experts/avis/index.html.haml_spec.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
describe 'experts/avis/index.html.haml', type: :view do
|
||||
let(:expert) { create(:expert) }
|
||||
let(:claimant) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: procedure) }
|
||||
let(:avis) { create(:avis, claimant: claimant, experts_procedure: experts_procedure) }
|
||||
|
||||
before do
|
||||
allow(view).to receive(:current_expert).and_return(avis.expert)
|
||||
assign(:avis_by_procedure, [avis].group_by(&:procedure))
|
||||
end
|
||||
|
||||
subject { render }
|
||||
|
||||
it 'renders avis in a list view' do
|
||||
expect(subject).to have_text(avis.procedure.libelle)
|
||||
expect(subject).to have_text("avis à donner")
|
||||
end
|
||||
|
||||
context 'when the dossier is deleted by instructeur' do
|
||||
before do
|
||||
avis.dossier.update!(state: "accepte", hidden_by_administration_at: Time.zone.now.beginning_of_day.utc)
|
||||
assign(:avis_by_procedure, avis.expert.avis.includes(dossier: [groupe_instructeur: :procedure]).where(dossiers: { hidden_by_administration_at: nil }).to_a.group_by(&:procedure))
|
||||
end
|
||||
|
||||
it 'doesn’t display the avis' do
|
||||
expect(subject).not_to have_text(avis.procedure.libelle)
|
||||
expect(subject).not_to have_text("avis à donner")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,8 +2,8 @@ describe 'experts/avis/instruction.html.haml', type: :view do
|
|||
let(:expert) { create(:expert) }
|
||||
let(:claimant) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure) }
|
||||
let!(:avis) { create(:avis, confidentiel: confidentiel, claimant: claimant, experts_procedure: experts_procedure) }
|
||||
let!(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: procedure) }
|
||||
let(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: procedure) }
|
||||
let(:avis) { create(:avis, confidentiel: confidentiel, claimant: claimant, experts_procedure: experts_procedure) }
|
||||
|
||||
before do
|
||||
assign(:avis, avis)
|
||||
|
@ -16,7 +16,7 @@ describe 'experts/avis/instruction.html.haml', type: :view do
|
|||
|
||||
context 'with a confidential avis' do
|
||||
let(:confidentiel) { true }
|
||||
it { is_expected.to have_text("Cet avis est confidentiel et n'est pas affiché aux autres experts consultés") }
|
||||
it { is_expected.to have_text("Cet avis est confidentiel et n’est pas affiché aux autres experts consultés") }
|
||||
end
|
||||
|
||||
context 'with a not confidential avis' do
|
Loading…
Reference in a new issue