2015-08-10 11:05:06 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature '_Commentaires_Flux Recapitulatif#Show Page' do
|
2015-09-24 10:56:12 +02:00
|
|
|
let(:dossier) { create(:dossier, :with_user, :with_procedure) }
|
2015-08-13 15:55:19 +02:00
|
|
|
let(:dossier_id) { dossier.id }
|
|
|
|
let(:email_commentaire) { 'mon_mail_de_commentaire@test.com' }
|
|
|
|
let!(:commentaire) { create(:commentaire, dossier: dossier, email: email_commentaire, body: 'ma super description') }
|
2015-08-20 16:59:15 +02:00
|
|
|
let(:body) { 'Commentaire de test' }
|
2015-08-10 11:05:06 +02:00
|
|
|
|
|
|
|
before do
|
2015-09-23 19:20:03 +02:00
|
|
|
login_as(dossier.user, scope: :user)
|
|
|
|
visit "/users/dossiers/#{dossier_id}/recapitulatif"
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'Affichage du flux de commentaire' do
|
|
|
|
scenario 'l\'email du contact est présent' do
|
2015-09-23 19:20:03 +02:00
|
|
|
expect(page).to have_css('#email_contact')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'la date du commentaire est présent' do
|
2015-08-20 16:59:15 +02:00
|
|
|
expect(page).to have_selector('span[id=created_at]')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'le corps du commentaire est présent' do
|
2015-09-23 19:20:03 +02:00
|
|
|
expect(page).to have_css('.description#body')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Affichage du formulaire de commentaire' do
|
|
|
|
scenario 'Le formulaire envoie vers /dossiers/:dossier_id/commentaire en #POST' do
|
2015-09-23 19:20:03 +02:00
|
|
|
expect(page).to have_selector("form[action='/users/dossiers/#{dossier_id}/commentaire'][method=post]")
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'Champs de texte' do
|
|
|
|
expect(page).to have_selector('textarea[id=texte_commentaire][name=texte_commentaire]')
|
|
|
|
end
|
|
|
|
end
|
2015-08-20 16:59:15 +02:00
|
|
|
end
|