spec: fix avis/index view spec
Due to a faulty naming convention, the test was not executed.
This commit is contained in:
parent
75da4d8c8d
commit
1ad807ab6b
2 changed files with 31 additions and 30 deletions
|
@ -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
|
Loading…
Reference in a new issue