BackofficeAvisController: make new avis confidentiel by default

This commit is contained in:
Simon Lehericey 2017-09-22 17:58:16 +02:00
parent 6de26e79e6
commit 53f0a16186
2 changed files with 2 additions and 1 deletions

View file

@ -4,7 +4,7 @@ class Backoffice::AvisController < ApplicationController
before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up, :create_gestionnaire]
def create
avis = Avis.new(create_params.merge(claimant: current_gestionnaire, dossier: dossier))
avis = Avis.new(create_params.merge(claimant: current_gestionnaire, dossier: dossier, confidentiel: true))
if avis.save
flash[:notice] = "Votre demande d'avis a bien été envoyée à #{avis.email_to_display}"

View file

@ -34,6 +34,7 @@ describe Backoffice::AvisController, type: :controller do
it { expect(created_avis.dossier_id).to eq(dossier.id) }
it { expect(created_avis.gestionnaire).to eq(gestionnaire) }
it { expect(created_avis.claimant).to eq(claimant) }
it { expect(created_avis.confidentiel).to be(true) }
end
end