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
|
flash.now.alert = errors
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :modifier }
|
format.html do
|
||||||
|
@dossier = @dossier.editing_fork_origin
|
||||||
|
render :modifier
|
||||||
|
end
|
||||||
|
|
||||||
format.turbo_stream do
|
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)
|
@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
|
render :update, layout: false
|
||||||
|
|
|
@ -475,16 +475,20 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the update fails' do
|
context 'when the update fails' do
|
||||||
|
render_views
|
||||||
|
|
||||||
before do
|
before do
|
||||||
expect_any_instance_of(Dossier).to receive(:valid?).and_return(false)
|
expect_any_instance_of(Dossier).to receive(:valid?).and_return(false)
|
||||||
expect_any_instance_of(Dossier).to receive(:errors).and_return(
|
expect_any_instance_of(Dossier).to receive(:errors).and_return(
|
||||||
[double(class: ActiveModel::Error, full_message: 'nop', base: first_champ)]
|
[double(class: ActiveModel::Error, full_message: 'nop', base: first_champ)]
|
||||||
)
|
)
|
||||||
|
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(response).to render_template(:modifier) }
|
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(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
|
end
|
||||||
|
|
||||||
context 'when a mandatory champ is missing' do
|
context 'when a mandatory champ is missing' do
|
||||||
|
|
Loading…
Add table
Reference in a new issue