2015-09-24 10:17:59 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-05-13 16:08:51 +02:00
|
|
|
describe 'users/recapitulatif/_commentaires_flux.html.haml', type: :view, vcr: { cassette_name: 'views_users_recapitulatif_commentaires_flux' } do
|
2016-02-04 14:08:35 +01:00
|
|
|
let(:dossier) { create(:dossier) }
|
2015-09-24 10:17:59 +02:00
|
|
|
let(:dossier_id) { dossier.id }
|
|
|
|
let(:email_commentaire) { 'mon_mail_de_commentaire@test.com' }
|
2016-04-20 16:51:57 +02:00
|
|
|
|
|
|
|
let(:document_upload) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') }
|
|
|
|
let(:pj) { create :piece_justificative, content: document_upload }
|
|
|
|
|
|
|
|
let!(:commentaire) { create(:commentaire, dossier: dossier, email: email_commentaire, body: 'ma super description', piece_justificative: pj) }
|
2015-09-24 10:17:59 +02:00
|
|
|
let(:body) { 'Commentaire de test' }
|
|
|
|
|
|
|
|
before do
|
2015-12-24 15:10:20 +01:00
|
|
|
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
|
2015-09-24 10:17:59 +02:00
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Affichage du flux de commentaire' do
|
|
|
|
it 'l\'email du contact est présent' do
|
|
|
|
expect(rendered).to have_selector('span[id=email_contact]')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'la date du commentaire est présent' do
|
|
|
|
expect(rendered).to have_selector('span[id=created_at]')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'le corps du commentaire est présent' do
|
|
|
|
expect(rendered).to have_selector('div[class=description][id=body]')
|
|
|
|
end
|
2016-04-20 16:51:57 +02:00
|
|
|
|
|
|
|
context 'when commentaire as PJ' do
|
|
|
|
it 'commentaire present the link' do
|
|
|
|
expect(rendered).to have_css('#piece_justificative')
|
|
|
|
end
|
|
|
|
end
|
2015-09-24 10:17:59 +02:00
|
|
|
end
|
|
|
|
end
|