ProcedurePresentation: display dossier date in d/m/Y

This commit is contained in:
simon lehericey 2018-10-26 09:21:01 +00:00
parent 3685c65fb7
commit 63db387984
3 changed files with 5 additions and 5 deletions

View file

@ -190,7 +190,7 @@ class ProcedurePresentation < ApplicationRecord
def get_value(dossier, table, column)
case table
when 'self'
dossier.send(column)
dossier.send(column)&.strftime('%d/%m/%Y')
when 'user', 'individual', 'etablissement'
dossier.send(table)&.send(column)
when 'type_de_champ'

View file

@ -35,7 +35,7 @@ feature "procedure filters" do
add_column("Créé le")
within ".dossiers-table" do
expect(page).to have_link("Créé le")
expect(page).to have_link(new_unfollow_dossier.created_at)
expect(page).to have_link(new_unfollow_dossier.created_at.strftime('%d/%m/%Y'))
end
end

View file

@ -135,14 +135,14 @@ describe ProcedurePresentation do
let(:column) { 'created_at' }
let(:dossier) { Timecop.freeze(Time.zone.local(1992, 3, 22)) { create(:dossier, procedure: procedure) } }
it { is_expected.to eq(Time.zone.local(1992, 3, 22)) }
it { is_expected.to eq(Time.zone.local(1992, 3, 22).strftime('%d/%m/%Y')) }
end
context 'for en_construction_at column' do
let(:column) { 'en_construction_at' }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: Time.zone.local(2018, 10, 17)) }
it { is_expected.to eq(Time.zone.local(2018, 10, 17)) }
it { is_expected.to eq(Time.zone.local(2018, 10, 17).strftime('%d/%m/%Y')) }
end
context 'for updated_at column' do
@ -151,7 +151,7 @@ describe ProcedurePresentation do
before { dossier.touch(time: Time.zone.local(2018, 9, 25)) }
it { is_expected.to eq(Time.zone.local(2018, 9, 25)) }
it { is_expected.to eq(Time.zone.local(2018, 9, 25).strftime('%d/%m/%Y')) }
end
end