demarches-normaliennes/spec/features/backoffice/add_commentaire_spec.rb

29 lines
1.1 KiB
Ruby
Raw Normal View History

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
let(:procedure) { create(:procedure, :published) }
2017-09-22 10:28:16 +02:00
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
let(:dossier_id) { dossier.id }
2015-08-20 16:59:15 +02:00
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') }
let(:email_commentaire) { 'test@test.com' }
2015-09-22 10:15:12 +02:00
let(:gestionnaire) { create(:gestionnaire) }
let(:email_pre_rempli) { 'toto@sgmap.fr' }
let(:body) { 'Commentaire de test' }
2015-08-10 11:05:06 +02:00
before do
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