feat(Users::CommencerController#commencer): ensure to redirect to replaced_by_procedure when it exisits

This commit is contained in:
Martin 2022-07-29 10:44:30 +02:00 committed by Paul Chavard
parent 80edf23446
commit 7f1018c5b0
2 changed files with 16 additions and 2 deletions

View file

@ -51,6 +51,17 @@ describe Users::CommencerController, type: :controller do
expect(response).to redirect_to(root_path)
end
end
context 'when procedure has a replaced_by_procedure' do
let(:path) { published_procedure.path }
it 'redirects to new procedure' do
replaced_by_procedure = create(:procedure, :published)
published_procedure.update!(replaced_by_procedure_id: replaced_by_procedure.id)
published_procedure.close!
expect(subject).to redirect_to(commencer_path(path: replaced_by_procedure.path))
end
end
end
describe '#commencer_test' do