use path_rewrite in commencer controller

This commit is contained in:
simon lehericey 2024-08-29 16:16:07 +02:00
parent 516205efd9
commit 6677f31652
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
3 changed files with 25 additions and 0 deletions

View file

@ -19,6 +19,18 @@ describe Users::CommencerController, type: :controller do
end
end
context 'when a path rewrite is present' do
let(:path) { 'from' }
let!(:path_rewrite) { PathRewrite.create(from: 'from', to: published_procedure.path) }
it 'redirects to the new path' do
expect(subject.status).to eq(200)
expect(subject).to render_template('show')
expect(assigns(:procedure)).to eq published_procedure
expect(assigns(:revision)).to eq published_procedure.published_revision
end
end
context 'when the path is for a draft procedure' do
let(:path) { draft_procedure.path }