commit
04db49b0a3
2 changed files with 8 additions and 1 deletions
|
@ -264,7 +264,7 @@ module NewUser
|
|||
end
|
||||
|
||||
def save_draft?
|
||||
params[:save_draft]
|
||||
dossier.brouillon? && params[:save_draft]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -355,6 +355,13 @@ describe NewUser::DossiersController, type: :controller do
|
|||
it { expect(response).to render_template(:brouillon) }
|
||||
it { expect(flash.notice).to eq('Votre brouillon a bien été sauvegardé.') }
|
||||
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:brouillon)) }
|
||||
|
||||
context 'and the dossier is in construction' do
|
||||
let!(:dossier) { create(:dossier, :en_construction, user: user) }
|
||||
|
||||
it { expect(response).to render_template(:brouillon) }
|
||||
it { expect(flash.alert).to eq(['Le champ l doit être rempli.', 'pj']) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue