2016-11-14 18:00:26 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'users: flux de commentaires' do
|
|
|
|
let(:user) { create(:user) }
|
2017-12-14 15:51:45 +01:00
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, user: user, state: "en_construction") }
|
2016-11-14 18:00:26 +01:00
|
|
|
let(:dossier_id) { dossier.id }
|
|
|
|
|
|
|
|
let(:champ1) { dossier.champs.first }
|
2018-02-13 17:00:19 +01:00
|
|
|
let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ, libelle: "subtitle")) }
|
2016-11-14 18:00:26 +01:00
|
|
|
|
|
|
|
let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) }
|
2018-07-26 16:14:24 +02:00
|
|
|
let!(:commentaire2) { create(:commentaire, dossier: dossier, email: 'paul.chavard@beta.gouv.fr') }
|
2016-11-14 18:00:26 +01:00
|
|
|
let!(:commentaire3) { create(:commentaire, dossier: dossier, champ: champ2) }
|
|
|
|
let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_as user, scope: :user
|
|
|
|
visit users_dossier_recapitulatif_path(dossier)
|
|
|
|
end
|
|
|
|
|
2016-11-16 16:23:43 +01:00
|
|
|
scenario "seuls les commentaires généraux sont affichés" do
|
2016-12-14 18:41:33 +01:00
|
|
|
comments = find(".commentaires")
|
|
|
|
expect(comments).to have_selector(".content", count: 1)
|
2018-07-26 16:14:24 +02:00
|
|
|
expect(comments).to have_content('paul.chavard')
|
|
|
|
expect(comments).not_to have_content('paul.chavard@beta.gouv.fr')
|
2016-11-14 18:00:26 +01:00
|
|
|
end
|
|
|
|
end
|