Sha256: cc5d327167abb025daa1effbf2bf2c9671830a61e3544f4f7b3042fb853de0ef
Contents?: true
Size: 1.35 KB
Versions: 34
Compression:
Stored size: 1.35 KB
Contents
require 'active_interaction' require 'active_support/all' require 'roqua/core_ext/active_interaction/filters/date_time_as_unix_extension' class DateTimeFilterOperation < ActiveInteraction::Base date_time :date_time, default: nil def execute date_time end end describe RoquaDateTimeAsUnixFilterExtension do let(:time) { Time.now.change(:usec => 0) } it 'unix integer time translates correctly to datetime' do expect(DateTimeFilterOperation.run! date_time: time.to_i).to eq time end it 'unix integer time as string translates correctly to datetime' do expect(DateTimeFilterOperation.run! date_time: time.to_i.to_s).to eq time end it 'transations and empty string to nil' do expect(DateTimeFilterOperation.run! date_time: '').to eq nil end end class TimeFilterOperation < ActiveInteraction::Base time :time, default: nil def execute time end end describe RoquaDateTimeAsUnixFilterExtension do let(:time) { Time.now.change(:usec => 0) } it 'unix integer time translates correctly to time' do expect(TimeFilterOperation.run! time: time.to_i).to eq time end it 'unix integer time as string translates correctly to datetime' do expect(TimeFilterOperation.run! time: time.to_i.to_s).to eq time end it 'transations and empty string to nil' do expect(TimeFilterOperation.run! time: '').to eq nil end end
Version data entries
34 entries across 34 versions & 1 rubygems