feat(rc): first stable

This commit is contained in:
Martin 2021-11-15 13:53:32 +01:00
parent 8b931a57d4
commit 3b78a9d81a
7 changed files with 30 additions and 20 deletions

View file

@ -52,29 +52,36 @@ describe 'shared/dossiers/messages/message.html.haml', type: :view do
let(:procedure) { create(:procedure) }
let(:dossier) { create(:dossier, :en_construction, commentaires: [commentaire], procedure: procedure) }
subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, connected_user: instructeur, show_reply_button: true }
let(:form_url) { instructeur_commentaire_path(commentaire.dossier.procedure, commentaire.dossier, commentaire) }
context 'on a procedure where commentaire had been written by connected instructeur' do
let(:commentaire) { create(:commentaire, instructeur: instructeur, body: 'Second message') }
it { is_expected.to have_css("div[data-test-delete-id=1]")}
it { is_expected.to have_selector("form[action=\"#{form_url}\"]")}
end
context 'on a procedure where commentaire had been written by connected instructeur and deleted' do
let(:commentaire) { create(:commentaire, instructeur: instructeur, body: 'Second message', deleted_at: 2.days.ago) }
it { is_expected.not_to have_selector("form[action=\"#{form_url}\"]")}
end
context 'on a procedure where commentaire had been written by connected an user' do
let(:commentaire) { create(:commentaire, email: create(:user).email, body: 'Second message') }
it { is_expected.not_to have_css("div[data-test-delete-id=1]")}
it { is_expected.not_to have_selector("form[action=\"#{form_url}\"]")}
end
context 'on a procedure where commentaire had been written by connected an expert' do
let(:commentaire) { create(:commentaire, expert: create(:expert), body: 'Second message') }
it { is_expected.not_to have_css("div[data-test-delete-id=1]")}
it { is_expected.not_to have_selector("form[action=\"#{form_url}\"]")}
end
context 'on a procedure where commentaire had been written another instructeur' do
let(:commentaire) { create(:commentaire, instructeur: create(:instructeur), body: 'Second message') }
it { is_expected.not_to have_css("div[data-test-delete-id=1]")}
it { is_expected.not_to have_selector("form[action=\"#{form_url}\"]")}
end
end
end