Sha256: ec896008a30051e14b2c7977344f5091a8a6dda9bb18b4ce49d0d7ce05042ae6
Contents?: true
Size: 890 Bytes
Versions: 134
Compression:
Stored size: 890 Bytes
Contents
module ForestLiana class OperatorDateIntervalParserTest < ActiveSupport::TestCase test 'OPERATOR_AFTER_X_HOURS_AGO and OPERATOR_BEFORE_X_HOURS_AGO should not take timezone into account' do # Setting a big timezone (GMT+10) on purpose, the timezone should not be applied on the result date operatorDateIntervalParser = OperatorDateIntervalParser.new('Australia/Sydney') result = operatorDateIntervalParser.get_date_filter(OperatorDateIntervalParser::OPERATOR_AFTER_X_HOURS_AGO, 2) hourComputed = result.split('> ')[1].tr('\'', '').to_datetime.hour assert hourComputed == Time.now.utc.hour - 2 result = operatorDateIntervalParser.get_date_filter(OperatorDateIntervalParser::OPERATOR_BEFORE_X_HOURS_AGO, 2) hourComputed = result.split('< ')[1].tr('\'', '').to_datetime.hour assert hourComputed == Time.now.utc.hour - 2 end end end
Version data entries
134 entries across 134 versions & 1 rubygems