dossier: add a stub page for the new dossier details
This commit is contained in:
parent
0ac28da207
commit
77eb89cb0f
6 changed files with 72 additions and 3 deletions
|
@ -26,9 +26,12 @@ module NewUser
|
|||
def show
|
||||
if dossier.brouillon?
|
||||
redirect_to modifier_dossier_path(dossier)
|
||||
else
|
||||
|
||||
elsif !Flipflop.new_dossier_details?
|
||||
redirect_to users_dossier_recapitulatif_path(dossier)
|
||||
end
|
||||
|
||||
@dossier = dossier
|
||||
end
|
||||
|
||||
def attestation
|
||||
|
|
3
app/views/new_user/dossiers/show.html.haml
Normal file
3
app/views/new_user/dossiers/show.html.haml
Normal file
|
@ -0,0 +1,3 @@
|
|||
%h1
|
||||
Dossier
|
||||
= @dossier.id
|
|
@ -17,6 +17,9 @@ Flipflop.configure do
|
|||
|
||||
feature :web_hook
|
||||
|
||||
feature :new_dossier_details,
|
||||
title: "Nouvelle page « Dossier »"
|
||||
|
||||
group :production do
|
||||
feature :remote_storage,
|
||||
default: Rails.env.production? || Rails.env.staging?
|
||||
|
|
|
@ -479,7 +479,13 @@ describe NewUser::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
describe '#show' do
|
||||
before { sign_in(user) }
|
||||
let(:new_dossier_details_enabled) { false }
|
||||
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, new_dossier_details_enabled)
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
subject! { get(:show, params: { id: dossier.id }) }
|
||||
|
||||
context 'when the dossier is a brouillon' do
|
||||
|
@ -489,7 +495,17 @@ describe NewUser::DossiersController, type: :controller do
|
|||
|
||||
context 'when the dossier has been submitted' do
|
||||
let(:dossier) { create(:dossier, :en_construction, user: user) }
|
||||
it { is_expected.to redirect_to(users_dossier_recapitulatif_path(dossier)) }
|
||||
|
||||
context 'and the new dossier details page is disabled' do
|
||||
let(:new_dossier_details_enabled) { false }
|
||||
it { is_expected.to redirect_to(users_dossier_recapitulatif_path(dossier)) }
|
||||
end
|
||||
|
||||
context 'and the new dossier details page is enabled' do
|
||||
let(:new_dossier_details_enabled) { true }
|
||||
it { expect(assigns(:dossier)).to eq(dossier) }
|
||||
it { is_expected.to render_template(:show) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
28
spec/features/new_user/dossier_details_spec.rb
Normal file
28
spec/features/new_user/dossier_details_spec.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
describe 'Dossier details:' do
|
||||
let(:user) { create(:user) }
|
||||
let(:dossier) { create(:dossier, :en_construction, user: user) }
|
||||
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, true)
|
||||
end
|
||||
|
||||
scenario 'the user can see the details of their dossier' do
|
||||
visit_dossier dossier
|
||||
|
||||
expect(page).to have_current_path(dossier_path(dossier))
|
||||
expect(page).to have_content(dossier.id)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def visit_dossier(dossier)
|
||||
visit dossier_path(dossier)
|
||||
|
||||
expect(page).to have_current_path(new_user_session_path)
|
||||
fill_in 'user_email', with: user.email
|
||||
fill_in 'user_password', with: user.password
|
||||
click_on 'Se connecter'
|
||||
|
||||
expect(page).to have_current_path(dossier_path(dossier))
|
||||
end
|
||||
end
|
16
spec/views/new_user/dossiers/show.html.haml_spec.rb
Normal file
16
spec/views/new_user/dossiers/show.html.haml_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'new_user/dossiers/show.html.haml', type: :view do
|
||||
let(:dossier) { create(:dossier, :with_service, state: 'brouillon', procedure: create(:procedure)) }
|
||||
|
||||
before do
|
||||
sign_in dossier.user
|
||||
assign(:dossier, dossier)
|
||||
end
|
||||
|
||||
subject! { render }
|
||||
|
||||
it 'affiche les informations du dossier' do
|
||||
expect(rendered).to have_text("Dossier #{dossier.id}")
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue