demarches-normaliennes/spec/views/users/recapitulatif/_commentaires_flux_spec.rb

39 lines
1.4 KiB
Ruby
Raw Normal View History

require 'spec_helper'
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) }
let(:dossier_id) { dossier.id }
let(:email_commentaire) { 'mon_mail_de_commentaire@test.com' }
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) }
let(:body) { 'Commentaire de test' }
before do
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
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
context 'when commentaire as PJ' do
it 'commentaire present the link' do
expect(rendered).to have_css('#piece_justificative')
end
end
end
end