Add CommentaireDecorator test

This commit is contained in:
Xavier J 2016-12-16 09:38:43 +01:00
parent a6ff698cf8
commit 02ec901777
2 changed files with 10 additions and 2 deletions

View file

@ -3,7 +3,5 @@ class CommentaireDecorator < Draper::Decorator
def created_at_fr
created_at.localtime.strftime('%d/%m/%Y - %H:%M')
rescue
'dd/mm/YYYY - HH:MM'
end
end

View file

@ -1,4 +1,14 @@
require 'spec_helper'
describe CommentaireDecorator do
let(:commentaire) { Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0)) {create :commentaire} }
let(:decorator) { commentaire.decorate }
describe 'created_at_fr' do
subject { decorator.created_at_fr }
context 'when created_at have a value' do
it { is_expected.to eq '01/09/2008 - 10:05' }
end
end
end