Simplify factory girl configuration for mail templates

This commit is contained in:
Frederic Merizen 2018-01-08 17:48:08 +01:00
parent 8d6d8026a6
commit 9afdb4c2c4
3 changed files with 7 additions and 11 deletions

View file

@ -1,13 +1,15 @@
FactoryGirl.define do FactoryGirl.define do
factory :mail_template, class: Mails::ClosedMail do factory :closed_mail, class: Mails::ClosedMail do
subject "Subject, voila voila" subject "Subject, voila voila"
body "Blabla ceci est mon body" body "Blabla ceci est mon body"
factory :dossier_submitted_mail_template, class: Mails::ReceivedMail factory :received_mail, class: Mails::ReceivedMail
factory :dossier_refused_mail_template, class: Mails::RefusedMail factory :refused_mail, class: Mails::RefusedMail
factory :dossier_en_instruction_mail_template, class: Mails::InitiatedMail do factory :without_continuation_mail, class: Mails::WithoutContinuationMail
factory :initiated_mail, class: Mails::InitiatedMail do
subject "[TPS] Accusé de réception pour votre dossier nº --numéro du dossier--" subject "[TPS] Accusé de réception pour votre dossier nº --numéro du dossier--"
body "Votre administration vous confirme la bonne réception de votre dossier nº --numéro du dossier--" body "Votre administration vous confirme la bonne réception de votre dossier nº --numéro du dossier--"
end end

View file

@ -1,6 +0,0 @@
FactoryGirl.define do
factory :received_mail, class: Mails::ReceivedMail do
subject "Mail d'accusé de bonne reception de votre dossier"
body "Votre dossier est correctement reçu"
end
end

View file

@ -2,7 +2,7 @@ require 'spec_helper'
describe 'admin/mail_templates/edit.html.haml', type: :view do describe 'admin/mail_templates/edit.html.haml', type: :view do
let(:procedure) { create(:procedure) } let(:procedure) { create(:procedure) }
let(:mail_template) { create(:mail_template, procedure: procedure) } let(:mail_template) { create(:received_mail, procedure: procedure) }
let(:all_tags) { mail_template.tags } let(:all_tags) { mail_template.tags }
before do before do