fix issue about casting date_time type fields (locomotivecms/engine#1086)

did committed Nov 27, 2015
commit d89c6d210c7a4d46010c6e99c36e241d23866b37
Showing 2 changed files with 4 additions and 4 deletions
locomotive/steam/entities/content_entry.rb b/lib/locomotive/steam/entities/content_entry.rb +1 -1
@@ @@ -139,7 +139,7 @@ module Locomotive::Steam
end
def _cast_date_time(field)
- _cast_time(field, :to_date)
+ _cast_time(field, :to_datetime)
end
def _cast_time(field, end_method)
spec/unit/entities/content_entry_spec.rb +3 -3
@@ @@ -151,11 +151,11 @@ describe Locomotive::Steam::ContentEntry do
context 'a date time' do
let(:field_type) { :date_time }
- let(:value) { '2007/06/29 00:00:00' }
- let(:datetime) { DateTime.parse('2007/06/29 00:00:00') }
+ let(:value) { '2007/06/29 10:00:00' }
+ let(:datetime) { DateTime.parse('2007/06/29 10:00:00') }
it { is_expected.to eq datetime }
context 'localized' do
- let(:value) { build_i18n_field(en: '2007/06/29 00:00:00', fr: datetime) }
+ let(:value) { build_i18n_field(en: '2007/06/29 10:00:00', fr: datetime) }
it { expect(subject.translations).to eq('en' => datetime, 'fr' => datetime) }
end
end