add attachment when instructor asking for a review
This commit is contained in:
parent
cb811df94f
commit
b32ed88f9b
6 changed files with 27 additions and 4 deletions
|
@ -126,7 +126,9 @@ describe Instructeurs::AvisController, type: :controller do
|
|||
let(:invite_linked_dossiers) { nil }
|
||||
|
||||
before do
|
||||
post :create_avis, params: { id: previous_avis.id, avis: { emails: emails, introduction: intro, confidentiel: asked_confidentiel, invite_linked_dossiers: invite_linked_dossiers } }
|
||||
@introduction_file = Rack::Test::UploadedFile.new("./spec/fixtures/files/piece_justificative_0.pdf", 'application/pdf')
|
||||
post :create_avis, params: { id: previous_avis.id, avis: { emails: emails, introduction: intro, confidentiel: asked_confidentiel, invite_linked_dossiers: invite_linked_dossiers, introduction_file: @introduction_file } }
|
||||
created_avis.reload
|
||||
end
|
||||
|
||||
context 'when an invalid email' do
|
||||
|
@ -139,6 +141,16 @@ describe Instructeurs::AvisController, type: :controller do
|
|||
it { expect(Avis.last).to eq(previous_avis) }
|
||||
end
|
||||
|
||||
context 'ask review with attachment' do
|
||||
let(:previous_avis_confidentiel) { false }
|
||||
let(:asked_confidentiel) { false }
|
||||
let(:emails) { ["toto@totomail.com"] }
|
||||
|
||||
it { expect(created_avis.introduction_file).to be_attached }
|
||||
it { expect(created_avis.introduction_file.filename).to eq("piece_justificative_0.pdf") }
|
||||
it { expect(flash.notice).to eq("Une demande d'avis a été envoyée à toto@totomail.com") }
|
||||
end
|
||||
|
||||
context 'with multiple emails' do
|
||||
let(:asked_confidentiel) { false }
|
||||
let(:previous_avis_confidentiel) { false }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue