tests
This commit is contained in:
parent
f1525a798f
commit
9d9ac54689
1 changed files with 12 additions and 1 deletions
|
@ -4,10 +4,12 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
|
||||||
subject { render 'instructeurs/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur }
|
subject { render 'instructeurs/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur }
|
||||||
|
|
||||||
let(:instructeur) { create(:instructeur) }
|
let(:instructeur) { create(:instructeur) }
|
||||||
|
let(:instructeur2) { create(:instructeur) }
|
||||||
|
let(:introduction_file) { fixture_file_upload('spec/fixtures/files/piece_justificative_0.pdf', 'application/pdf') }
|
||||||
let(:expert) { create(:expert) }
|
let(:expert) { create(:expert) }
|
||||||
let!(:dossier) { create(:dossier) }
|
let!(:dossier) { create(:dossier) }
|
||||||
let(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: dossier.procedure) }
|
let(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: dossier.procedure) }
|
||||||
let(:avis) { [create(:avis, claimant: instructeur, experts_procedure: experts_procedure)] }
|
let(:avis) { [create(:avis, claimant: instructeur, experts_procedure: experts_procedure, introduction_file: introduction_file)] }
|
||||||
let(:seen_at) { avis.first.created_at + 1.hour }
|
let(:seen_at) { avis.first.created_at + 1.hour }
|
||||||
|
|
||||||
it { is_expected.to have_text(avis.first.introduction) }
|
it { is_expected.to have_text(avis.first.introduction) }
|
||||||
|
@ -16,6 +18,7 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
|
||||||
context 'with a seen_at before avis created_at' do
|
context 'with a seen_at before avis created_at' do
|
||||||
let(:seen_at) { avis.first.created_at - 1.hour }
|
let(:seen_at) { avis.first.created_at - 1.hour }
|
||||||
|
|
||||||
|
it { is_expected.to have_text("Fichier joint à la demande d’avis") }
|
||||||
it { is_expected.to have_css(".highlighted") }
|
it { is_expected.to have_css(".highlighted") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -26,4 +29,12 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
|
||||||
expect(subject).to include(simple_format(avis.first.answer))
|
expect(subject).to include(simple_format(avis.first.answer))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with another instructeur' do
|
||||||
|
let(:avis) { [create(:avis, :with_answer, claimant: instructeur2, experts_procedure: experts_procedure, introduction_file: introduction_file)] }
|
||||||
|
|
||||||
|
it 'shows the files attached to the avis request' do
|
||||||
|
expect(subject).to have_text("Fichier joint à la demande d’avis")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue