Add Commentaire.is_sent_by_system? and .is_sent_by(someone)

And use it in CommentaireHelper and in the _message_icon and _message_issuer partials
This commit is contained in:
Nicolas Bouilleaud 2019-07-01 18:14:02 +02:00 committed by Pierre de La Morinerie
parent 2abd93d360
commit 3f439ac07a
5 changed files with 30 additions and 18 deletions

View file

@ -7,6 +7,18 @@ describe Commentaire do
it { is_expected.to have_db_column(:updated_at) }
it { is_expected.to belong_to(:dossier) }
describe "#is_sent_by_system?" do
subject { commentaire.is_sent_by_system? }
let(:commentaire) { build :commentaire, email: email }
context 'with a commentaire created by the DS system' do
let(:email) { CONTACT_EMAIL }
it { is_expected.to be_truthy }
end
end
describe "#redacted_email" do
subject { commentaire.redacted_email }