2021-11-25 16:26:55 +01:00
|
|
|
describe 'administrateurs/procedures/edit.html.haml' do
|
2020-06-30 17:53:54 +02:00
|
|
|
let(:logo) { fixture_file_upload('spec/fixtures/files/logo_test_procedure.png', 'image/png') }
|
2019-07-23 12:09:48 +02:00
|
|
|
let(:procedure) { create(:procedure, logo: logo, lien_site_web: 'http://some.website') }
|
2022-08-12 14:46:54 +02:00
|
|
|
let(:populate_zones_task) { Rake::Task['zones:populate_zones'] }
|
2016-06-06 18:25:51 +02:00
|
|
|
|
|
|
|
before do
|
2022-08-12 14:46:54 +02:00
|
|
|
Flipper.enable(:zonage)
|
|
|
|
populate_zones_task.invoke
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
populate_zones_task.reenable
|
2016-06-06 18:25:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when procedure logo is present' do
|
|
|
|
it 'display on the page' do
|
2022-08-12 14:46:54 +02:00
|
|
|
assign(:procedure, procedure)
|
|
|
|
render
|
|
|
|
|
2019-09-24 16:38:58 +02:00
|
|
|
expect(rendered).to have_selector('.procedure-logos')
|
2016-06-06 18:25:51 +02:00
|
|
|
end
|
|
|
|
end
|
2022-08-12 14:46:54 +02:00
|
|
|
|
|
|
|
context 'when procedure has never been published' do
|
|
|
|
before { Timecop.freeze(now) }
|
|
|
|
after { Timecop.return }
|
|
|
|
|
|
|
|
let(:procedure) { create(:procedure, zone: Zone.find_by(acronym: 'MTEI')) }
|
|
|
|
let(:now) { Time.zone.parse('18/05/2022') }
|
|
|
|
|
|
|
|
it 'displays zones with label available at the creation date' do
|
|
|
|
assign(:procedure, procedure)
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_content("Ministère du Travail")
|
|
|
|
expect(rendered).not_to have_content("Ministère du Travail, du Plein emploi et de l'Insertion")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when procedure has been published' do
|
|
|
|
before { Timecop.freeze(now) }
|
|
|
|
after { Timecop.return }
|
|
|
|
|
|
|
|
let(:procedure) { create(:procedure, zone: Zone.find_by(acronym: 'MTEI')) }
|
|
|
|
let(:now) { Time.zone.parse('18/05/2022') }
|
|
|
|
|
|
|
|
it 'displays zones with label available at the creation date' do
|
|
|
|
Timecop.freeze(Time.zone.parse('22/05/2022')) do
|
|
|
|
procedure.publish!
|
|
|
|
end
|
|
|
|
|
|
|
|
assign(:procedure, procedure)
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_content("Ministère du Travail, du Plein emploi et de l'Insertion")
|
|
|
|
end
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|