Before save copy body in rich_body
This commit is contained in:
parent
d13b7f953f
commit
10d3ba10f2
2 changed files with 11 additions and 0 deletions
|
@ -11,8 +11,13 @@ module MailTemplateConcern
|
|||
replace_tags(body, dossier)
|
||||
end
|
||||
|
||||
def update_rich_body
|
||||
self.rich_body = self.body
|
||||
end
|
||||
|
||||
included do
|
||||
has_rich_text :rich_body
|
||||
before_save :update_rich_body
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
|
|
@ -113,4 +113,10 @@ describe MailTemplateConcern do
|
|||
expect(initiated_mail.body_for_dossier(dossier2)).to eq("n #{dossier2.id}")
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update_rich_body' do
|
||||
before { initiated_mail.update(body: "Voici le corps du mail") }
|
||||
|
||||
it { expect(initiated_mail.rich_body.to_plain_text).to eq(initiated_mail.body) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue