From fb16d4582d45c65f345517fd05af3a26b089cdb5 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Fri, 16 Dec 2016 09:43:59 +0100 Subject: [PATCH] Delete un-user code in DossierDecorator --- app/decorators/dossier_decorator.rb | 16 ---------------- spec/decorators/dossier_decorator_spec.rb | 7 ++++++- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/app/decorators/dossier_decorator.rb b/app/decorators/dossier_decorator.rb index 109b95bf7..8bf76769b 100644 --- a/app/decorators/dossier_decorator.rb +++ b/app/decorators/dossier_decorator.rb @@ -2,12 +2,6 @@ class DossierDecorator < Draper::Decorator delegate :current_page, :per_page, :offset, :total_entries, :total_pages delegate_all - def display_date - date_previsionnelle.localtime.strftime('%d/%m/%Y') - rescue - 'dd/mm/YYYY' - end - def first_creation created_at.localtime.strftime('%d/%m/%Y %H:%M') end @@ -20,16 +14,6 @@ class DossierDecorator < Draper::Decorator DossierDecorator.case_state_fr state end - def class_qp_active - 'qp' if procedure.module_api_carto.quartiers_prioritaires - end - - def state_color_class - return 'text-danger' if waiting_for_gestionnaire? - return 'text-info' if waiting_for_user? - return 'text-success' if termine? - end - def self.case_state_fr state=self.state h.t("activerecord.attributes.dossier.state.#{state}") end diff --git a/spec/decorators/dossier_decorator_spec.rb b/spec/decorators/dossier_decorator_spec.rb index 1dfef816a..d2a25c608 100644 --- a/spec/decorators/dossier_decorator_spec.rb +++ b/spec/decorators/dossier_decorator_spec.rb @@ -1,9 +1,14 @@ require 'spec_helper' describe DossierDecorator do - let(:dossier) { create(:dossier, updated_at: Time.new(2015, 12, 24, 14, 10)) } + let(:dossier) { create(:dossier, created_at: Time.new(2015, 12, 24, 14, 10), updated_at: Time.new(2015, 12, 24, 14, 10)) } subject { dossier.decorate } + describe 'created_at' do + subject { super().created_at } + it { is_expected.to eq('24/12/2015 14:10') } + end + describe 'last_update' do subject { super().last_update } it { is_expected.to eq('24/12/2015 14:10') }