Merge pull request #2820 from betagouv/dev

2018-10-12-01
This commit is contained in:
LeSim 2018-10-12 12:30:11 +02:00 committed by GitHub
commit 04db49b0a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -264,7 +264,7 @@ module NewUser
end
def save_draft?
params[:save_draft]
dossier.brouillon? && params[:save_draft]
end
end
end

View file

@ -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