Procedure: remove mail_template
This commit is contained in:
parent
206d56f106
commit
70b2020656
3 changed files with 10 additions and 10 deletions
|
@ -3,8 +3,6 @@ class Procedure < ActiveRecord::Base
|
|||
has_many :types_de_champ, class_name: 'TypeDeChampPublic', dependent: :destroy
|
||||
has_many :types_de_champ_private, dependent: :destroy
|
||||
has_many :dossiers
|
||||
has_many :mail_templates
|
||||
|
||||
|
||||
has_one :procedure_path, dependent: :destroy
|
||||
|
||||
|
@ -29,6 +27,15 @@ class Procedure < ActiveRecord::Base
|
|||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||
|
||||
# for all those mails do
|
||||
# has_one initiated_mail
|
||||
#
|
||||
# add a method to return default mail if none is saved
|
||||
# define method :initiated_mail_with_override
|
||||
# self initiated_mail_without_override || InitiatedMail.default
|
||||
# end
|
||||
# alias_method_chain :initiated_mail, :override
|
||||
|
||||
%w(InitiatedMail ReceivedMail ClosedMail RefusedMail WithoutContinuationMail).each do |name|
|
||||
has_one "#{name.underscore}".to_sym
|
||||
define_method("#{name.underscore}_with_override") do
|
||||
|
@ -91,7 +98,7 @@ class Procedure < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def clone
|
||||
procedure = self.deep_clone(include: [:types_de_piece_justificative, :types_de_champ, :types_de_champ_private, :module_api_carto, :mail_templates, types_de_champ: [:drop_down_list]])
|
||||
procedure = self.deep_clone(include: [:types_de_piece_justificative, :types_de_champ, :types_de_champ_private, :module_api_carto, types_de_champ: [:drop_down_list]])
|
||||
procedure.archived = false
|
||||
procedure.published = false
|
||||
procedure.logo_secure_token = nil
|
||||
|
|
|
@ -9,7 +9,6 @@ FactoryGirl.define do
|
|||
published false
|
||||
cerfa_flag false
|
||||
administrateur { create(:administrateur) }
|
||||
mail_templates { [create(:mail_template, :dossier_received)]}
|
||||
|
||||
after(:build) do |procedure, _evaluator|
|
||||
if procedure.module_api_carto.nil?
|
||||
|
|
|
@ -5,7 +5,6 @@ describe Procedure do
|
|||
it { is_expected.to have_many(:types_de_piece_justificative) }
|
||||
it { is_expected.to have_many(:types_de_champ) }
|
||||
it { is_expected.to have_many(:dossiers) }
|
||||
it { is_expected.to have_many(:mail_templates) }
|
||||
it { is_expected.to have_one(:module_api_carto) }
|
||||
it { is_expected.to belong_to(:administrateur) }
|
||||
it { is_expected.to have_many(:preference_list_dossiers) }
|
||||
|
@ -182,7 +181,6 @@ describe Procedure do
|
|||
expect(subject.types_de_piece_justificative.size).to eq procedure.types_de_piece_justificative.size
|
||||
expect(subject.types_de_champ.size).to eq procedure.types_de_champ.size
|
||||
expect(subject.types_de_champ_private.size).to eq procedure.types_de_champ_private.size
|
||||
expect(subject.mail_templates.size).to eq procedure.mail_templates.size
|
||||
|
||||
subject.types_de_champ.zip(procedure.types_de_champ).each do |stc, ptc|
|
||||
expect(stc).to have_same_attributes_as(ptc)
|
||||
|
@ -195,10 +193,6 @@ describe Procedure do
|
|||
subject.types_de_piece_justificative.zip(procedure.types_de_piece_justificative).each do |stc, ptc|
|
||||
expect(stc).to have_same_attributes_as(ptc)
|
||||
end
|
||||
|
||||
subject.mail_templates.zip(procedure.mail_templates).each do |stc, ptc|
|
||||
expect(stc).to have_same_attributes_as(ptc)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should not duplicate specific related objects' do
|
||||
|
|
Loading…
Reference in a new issue