2023-03-06 15:51:08 +01:00
|
|
|
describe 'shared/_procedure_description', type: :view do
|
2023-01-31 18:52:47 +01:00
|
|
|
let(:estimated_duration_visible) { true }
|
|
|
|
let(:procedure) { create(:procedure, :published, :with_service, estimated_duration_visible:) }
|
2020-05-27 11:25:43 +02:00
|
|
|
|
|
|
|
subject { render partial: 'shared/procedure_description', locals: { procedure: procedure } }
|
|
|
|
|
|
|
|
it 'renders the view' do
|
|
|
|
subject
|
|
|
|
expect(rendered).to have_selector('.procedure-logos')
|
|
|
|
expect(rendered).to have_text(procedure.libelle)
|
|
|
|
expect(rendered).to have_text(procedure.description)
|
2022-05-31 16:58:03 +02:00
|
|
|
expect(rendered).to have_text('Temps de remplissage estimé')
|
2020-05-27 11:25:43 +02:00
|
|
|
end
|
|
|
|
|
2023-01-31 18:52:47 +01:00
|
|
|
context 'procedure with estimated duration not visible' do
|
|
|
|
let(:estimated_duration_visible) { false }
|
|
|
|
it 'hides the estimated duration' do
|
|
|
|
subject
|
|
|
|
expect(rendered).not_to have_text('Temps de remplissage estimé')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-27 11:25:43 +02:00
|
|
|
it 'does not show empty date limite' do
|
|
|
|
subject
|
|
|
|
expect(rendered).not_to have_text('Date limite')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the procedure has an auto_archive date' do
|
|
|
|
let(:procedure) { create(:procedure, :published, :with_service, :with_auto_archive) }
|
|
|
|
it 'shows the auto_archive_on' do
|
|
|
|
subject
|
|
|
|
expect(rendered).to have_text('Date limite')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|