DossierController: extract dossier_id from params[:id]
This commit is contained in:
parent
612a8c4b91
commit
3483ec075b
2 changed files with 4 additions and 3 deletions
|
@ -23,7 +23,8 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
create_dossier_facade params[:id]
|
dossier_id = params[:id]
|
||||||
|
create_dossier_facade dossier_id
|
||||||
|
|
||||||
unless @facade.nil?
|
unless @facade.nil?
|
||||||
@champs_private = @facade.champs_private
|
@champs_private = @facade.champs_private
|
||||||
|
@ -31,7 +32,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
@headers_private = @champs_private.select { |champ| champ.type_champ == 'header_section' }
|
@headers_private = @champs_private.select { |champ| champ.type_champ == 'header_section' }
|
||||||
end
|
end
|
||||||
|
|
||||||
Notification.where(dossier_id: params[:id].to_i).update_all already_read: true
|
Notification.where(dossier_id: dossier_id).update_all already_read: true
|
||||||
|
|
||||||
@new_avis = Avis.new(introduction: "Bonjour, merci de me donner votre avis sur ce dossier.")
|
@new_avis = Avis.new(introduction: "Bonjour, merci de me donner votre avis sur ce dossier.")
|
||||||
end
|
end
|
||||||
|
|
|
@ -97,7 +97,7 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
|
|
||||||
describe 'all notifications unread are changed' do
|
describe 'all notifications unread are changed' do
|
||||||
it do
|
it do
|
||||||
expect(Notification).to receive(:where).with(dossier_id: dossier_id).and_return(Notification::ActiveRecord_Relation)
|
expect(Notification).to receive(:where).with(dossier_id: dossier_id.to_s).and_return(Notification::ActiveRecord_Relation)
|
||||||
expect(Notification::ActiveRecord_Relation).to receive(:update_all).with(already_read: true).and_return(true)
|
expect(Notification::ActiveRecord_Relation).to receive(:update_all).with(already_read: true).and_return(true)
|
||||||
|
|
||||||
subject
|
subject
|
||||||
|
|
Loading…
Reference in a new issue