commit
cc5a729927
4 changed files with 48 additions and 5 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
%h2{ style: 'font-size: 20px; font-weight: 300; margin: 25px 0 5px;' }
|
||||
#{procedure_overview.procedure.libelle}
|
||||
= link_to 'voir', procedure_url(procedure_overview.procedure), style: 'color: #4393F3; font-size: 14px;'
|
||||
= link_to 'voir', gestionnaire_procedure_url(procedure_overview.procedure), style: 'color: #4393F3; font-size: 14px;'
|
||||
%table{ cellpadding: '0', cellspacing: '0', style: 'width: 100%; padding-bottom: 20px;' }
|
||||
%tbody
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
- if procedure_overview.old_dossiers_en_construction.count < 6
|
||||
\:
|
||||
- old_dossiers_en_construction = procedure_overview.old_dossiers_en_construction.map do |old_dossier|
|
||||
- link_to "nº #{old_dossier.id}", dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #4393F3;'
|
||||
- link_to "nº #{old_dossier.id}", gestionnaire_dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #4393F3;'
|
||||
- end.join(', ')
|
||||
= sanitize(old_dossiers_en_construction, attributes: %w(href style))
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
- if procedure_overview.old_dossiers_en_instruction.count < 6
|
||||
\:
|
||||
- old_dossiers_en_instruction = procedure_overview.old_dossiers_en_instruction.map do |old_dossier|
|
||||
- link_to "nº #{old_dossier.id}", dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #4393F3;'
|
||||
- link_to "nº #{old_dossier.id}", gestionnaire_dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #4393F3;'
|
||||
- end.join(', ')
|
||||
= sanitize(old_dossiers_en_instruction, attributes: %w(href style))
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Bonjour,
|
|||
|
||||
<%= @sender.email %> vous a envoyé le dossier nº <%= @dossier.id %>, cliquez sur le lien ci-dessous pour y accéder :
|
||||
|
||||
<%= dossier_url(@dossier.procedure, @dossier) %>
|
||||
<%= gestionnaire_dossier_url(@dossier.procedure, @dossier) %>
|
||||
|
||||
Bonne journée,
|
||||
|
||||
|
|
39
spec/mailers/gestionnaire_mailer_spec.rb
Normal file
39
spec/mailers/gestionnaire_mailer_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
RSpec.describe GestionnaireMailer, type: :mailer do
|
||||
describe '#send_dossier' do
|
||||
let(:sender) { create(:gestionnaire) }
|
||||
let(:recipient) { create(:gestionnaire) }
|
||||
let(:dossier) { create(:dossier) }
|
||||
|
||||
subject { described_class.send_dossier(sender, dossier, recipient) }
|
||||
|
||||
it { expect(subject.body).to include('Bonjour') }
|
||||
end
|
||||
|
||||
describe '#last_week_overview' do
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
||||
let(:dossier) { create(:dossier) }
|
||||
let(:last_week_overview) do
|
||||
procedure_overview = double('po',
|
||||
procedure: procedure,
|
||||
created_dossiers_count: 0,
|
||||
dossiers_en_construction_count: 1,
|
||||
old_dossiers_en_construction: [dossier],
|
||||
dossiers_en_construction_description: 'desc',
|
||||
dossiers_en_instruction_count: 1,
|
||||
old_dossiers_en_instruction: [dossier],
|
||||
dossiers_en_instruction_description: 'desc')
|
||||
|
||||
{
|
||||
start_date: DateTime.now,
|
||||
procedure_overviews: [procedure_overview]
|
||||
}
|
||||
end
|
||||
|
||||
before { allow(gestionnaire).to receive(:last_week_overview).and_return(last_week_overview) }
|
||||
|
||||
subject { described_class.last_week_overview(gestionnaire) }
|
||||
|
||||
it { expect(subject.body).to include('Vos activités') }
|
||||
end
|
||||
end
|
|
@ -1,6 +1,10 @@
|
|||
class GestionnaireMailerPreview < ActionMailer::Preview
|
||||
def last_week_overview
|
||||
gestionnaire = Gestionnaire.first
|
||||
GestionnaireMailer.last_week_overview(gestionnaire, gestionnaire.last_week_overview)
|
||||
GestionnaireMailer.last_week_overview(gestionnaire)
|
||||
end
|
||||
|
||||
def send_dossier
|
||||
GestionnaireMailer.send_dossier(Gestionnaire.first, Dossier.first, Gestionnaire.last)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue