fix(dossier): submit en_construction render views in error with dossier origin
This commit is contained in:
parent
218c7d08c2
commit
b626714610
2 changed files with 9 additions and 1 deletions
|
@ -229,7 +229,11 @@ module Users
|
|||
flash.now.alert = errors
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :modifier }
|
||||
format.html do
|
||||
@dossier = @dossier.editing_fork_origin
|
||||
render :modifier
|
||||
end
|
||||
|
||||
format.turbo_stream do
|
||||
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_public_params.fetch(:champs_public_all_attributes), dossier.champs_public_all)
|
||||
render :update, layout: false
|
||||
|
|
|
@ -475,16 +475,20 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when the update fails' do
|
||||
render_views
|
||||
|
||||
before do
|
||||
expect_any_instance_of(Dossier).to receive(:valid?).and_return(false)
|
||||
expect_any_instance_of(Dossier).to receive(:errors).and_return(
|
||||
[double(class: ActiveModel::Error, full_message: 'nop', base: first_champ)]
|
||||
)
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
it { expect(response).to render_template(:modifier) }
|
||||
it { expect(flash.alert).to eq(["Le champ « #{first_champ.libelle} » nop, #{anchor_to_first_champ}"]) }
|
||||
it { expect(response.body).to include("Dossier nº #{dossier.id}") }
|
||||
end
|
||||
|
||||
context 'when a mandatory champ is missing' do
|
||||
|
|
Loading…
Add table
Reference in a new issue