commencer: redirect to the procedure page after sign-in and sign-up
This commit is contained in:
parent
016e5f2e6f
commit
bb753ce23e
11 changed files with 62 additions and 27 deletions
|
@ -24,7 +24,7 @@ RSpec.describe ProcedureContextConcern, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when no procedure_id is present in the stored return location' do
|
||||
context 'when the stored return location is not a procedure URL' do
|
||||
before do
|
||||
controller.store_location_for(:user, dossiers_path)
|
||||
end
|
||||
|
@ -36,9 +36,9 @@ RSpec.describe ProcedureContextConcern, type: :controller do
|
|||
end
|
||||
|
||||
context 'when a procedure location has been stored' do
|
||||
context 'when the stored procedure does not exist' do
|
||||
context 'when the procedure path does not exist' do
|
||||
before do
|
||||
controller.store_location_for(:user, new_dossier_path(procedure_id: '0'))
|
||||
controller.store_location_for(:user, commencer_path(path: 'non-existent-path'))
|
||||
end
|
||||
|
||||
it 'redirects with an error' do
|
||||
|
@ -47,11 +47,11 @@ RSpec.describe ProcedureContextConcern, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the stored procedure is not published' do
|
||||
let(:procedure) { create :procedure }
|
||||
context 'when the procedure path exists, but not with the same publication status' do
|
||||
let(:published_procedure) { create :procedure, :published }
|
||||
|
||||
before do
|
||||
controller.store_location_for(:user, new_dossier_path(procedure_id: procedure.id))
|
||||
controller.store_location_for(:user, commencer_test_path(path: published_procedure.path))
|
||||
end
|
||||
|
||||
it 'redirects with an error' do
|
||||
|
@ -60,16 +60,29 @@ RSpec.describe ProcedureContextConcern, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the stored procedure exists' do
|
||||
let(:procedure) { create :procedure, :published }
|
||||
context 'when the stored procedure is in test' do
|
||||
let(:test_procedure) { create :procedure, :with_path }
|
||||
|
||||
before do
|
||||
controller.store_location_for(:user, new_dossier_path(procedure_id: procedure.id))
|
||||
controller.store_location_for(:user, commencer_test_path(path: test_procedure.path))
|
||||
end
|
||||
|
||||
it 'succeeds, and assigns the procedure on the controller' do
|
||||
expect(subject.status).to eq 200
|
||||
expect(assigns(:procedure)).to eq procedure
|
||||
expect(assigns(:procedure)).to eq test_procedure
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the stored procedure is published' do
|
||||
let(:published_procedure) { create :procedure, :published }
|
||||
|
||||
before do
|
||||
controller.store_location_for(:user, commencer_path(path: published_procedure.path))
|
||||
end
|
||||
|
||||
it 'succeeds, and assigns the procedure on the controller' do
|
||||
expect(subject.status).to eq 200
|
||||
expect(assigns(:procedure)).to eq published_procedure
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue