models: require belong_to associations on mail templates
This commit is contained in:
parent
29e8c43e5e
commit
a7361fdbd3
7 changed files with 9 additions and 8 deletions
|
@ -13,7 +13,7 @@ module Mails
|
|||
class ClosedMail < ApplicationRecord
|
||||
include MailTemplateConcern
|
||||
|
||||
belongs_to :procedure
|
||||
belongs_to :procedure, optional: false
|
||||
|
||||
SLUG = "closed_mail"
|
||||
DISPLAYED_NAME = "Accusé d'acceptation"
|
||||
|
|
|
@ -13,7 +13,7 @@ module Mails
|
|||
class InitiatedMail < ApplicationRecord
|
||||
include MailTemplateConcern
|
||||
|
||||
belongs_to :procedure
|
||||
belongs_to :procedure, optional: false
|
||||
|
||||
SLUG = "initiated_mail"
|
||||
DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/initiated_mail"
|
||||
|
|
|
@ -13,7 +13,7 @@ module Mails
|
|||
class ReceivedMail < ApplicationRecord
|
||||
include MailTemplateConcern
|
||||
|
||||
belongs_to :procedure
|
||||
belongs_to :procedure, optional: false
|
||||
|
||||
SLUG = "received_mail"
|
||||
DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/received_mail"
|
||||
|
|
|
@ -13,7 +13,7 @@ module Mails
|
|||
class RefusedMail < ApplicationRecord
|
||||
include MailTemplateConcern
|
||||
|
||||
belongs_to :procedure
|
||||
belongs_to :procedure, optional: false
|
||||
|
||||
SLUG = "refused_mail"
|
||||
DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/refused_mail"
|
||||
|
|
|
@ -13,7 +13,7 @@ module Mails
|
|||
class WithoutContinuationMail < ApplicationRecord
|
||||
include MailTemplateConcern
|
||||
|
||||
belongs_to :procedure
|
||||
belongs_to :procedure, optional: false
|
||||
|
||||
SLUG = "without_continuation"
|
||||
DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/without_continuation_mail"
|
||||
|
|
|
@ -2,6 +2,7 @@ FactoryBot.define do
|
|||
factory :closed_mail, class: Mails::ClosedMail do
|
||||
subject { "Subject, voila voila" }
|
||||
body { "Blabla ceci est mon body" }
|
||||
association :procedure
|
||||
|
||||
factory :received_mail, class: Mails::ReceivedMail
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ describe Procedure do
|
|||
|
||||
context 'with a custom mail template' do
|
||||
context 'that contains a lien attestation tag' do
|
||||
let(:closed_mail) { create(:closed_mail, body: '--lien attestation--') }
|
||||
let(:closed_mail) { build(:closed_mail, body: '--lien attestation--') }
|
||||
|
||||
context 'when the procedure doesn’t have an attestation' do
|
||||
let(:procedure) { procedure_without_attestation }
|
||||
|
@ -104,7 +104,7 @@ describe Procedure do
|
|||
end
|
||||
|
||||
context 'that doesn’t contain a lien attestation tag' do
|
||||
let(:closed_mail) { create(:closed_mail) }
|
||||
let(:closed_mail) { build(:closed_mail) }
|
||||
|
||||
context 'when the procedure doesn’t have an attestation' do
|
||||
let(:procedure) { procedure_without_attestation }
|
||||
|
@ -342,7 +342,7 @@ describe Procedure do
|
|||
let!(:type_de_champ_private_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||
let!(:type_de_champ_private_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1) }
|
||||
let!(:type_de_champ_private_2) { create(:type_de_champ_drop_down_list, :private, procedure: procedure, order_place: 2) }
|
||||
let(:received_mail) { create(:received_mail) }
|
||||
let(:received_mail) { build(:received_mail) }
|
||||
let(:from_library) { false }
|
||||
let(:administrateur) { procedure.administrateurs.first }
|
||||
|
||||
|
|
Loading…
Reference in a new issue