2015-08-10 11:05:06 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-09-22 15:00:59 +02:00
|
|
|
feature 'add commentaire on backoffice' do
|
2017-07-18 15:26:33 +02:00
|
|
|
let(:procedure) { create(:procedure, :published) }
|
2017-12-14 15:51:45 +01:00
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
2015-08-13 15:55:19 +02:00
|
|
|
let(:dossier_id) { dossier.id }
|
2015-08-20 16:59:15 +02:00
|
|
|
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') }
|
2015-08-13 15:55:19 +02:00
|
|
|
let(:email_commentaire) { 'test@test.com' }
|
2015-09-22 10:15:12 +02:00
|
|
|
let(:gestionnaire) { create(:gestionnaire) }
|
2015-08-13 15:55:19 +02:00
|
|
|
let(:email_pre_rempli) { 'toto@sgmap.fr' }
|
|
|
|
let(:body) { 'Commentaire de test' }
|
2015-08-10 11:05:06 +02:00
|
|
|
|
|
|
|
before do
|
2017-05-02 15:58:21 +02:00
|
|
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
2015-09-22 10:15:12 +02:00
|
|
|
login_as gestionnaire, scope: :gestionnaire
|
2015-09-22 15:00:59 +02:00
|
|
|
visit backoffice_dossier_path(dossier)
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'Affichage du formulaire de commentaire' do
|
|
|
|
scenario 'Le formulaire envoie vers /dossiers/:dossier_id/commentaire en #POST' do
|
2015-09-22 15:00:59 +02:00
|
|
|
expect(page).to have_selector("form[action='/backoffice/commentaires?dossier_id=#{dossier_id}'][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
|