2016-11-14 18:00:26 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'users: flux de commentaires' do
|
|
|
|
let(:user) { create(:user) }
|
2018-08-28 14:10:55 +02:00
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, user: user, state: Dossier.states.fetch(: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
|
2018-09-27 16:52:17 +02:00
|
|
|
Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, false)
|
2016-11-14 18:00:26 +01:00
|
|
|
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
|