Sha256: df1fa7aeaf7adc73f34c2aea7764dd2edbf4d922fbff0b3f1da3fb087cc226d0
Contents?: true
Size: 1.47 KB
Versions: 62
Compression:
Stored size: 1.47 KB
Contents
require 'test_helper' module Workarea module Search class DateFilterTest < TestCase def test_query_value search = AdminOrders.new(placed_at_greater_than: '2016-08-26') filter = DateFilter.new(search, 'placed_at', :gte) assert_equal(Time.zone.local(2016, 8, 26), filter.query_value) search = AdminOrders.new( placed_at_greater_than: '2016-08-26', placed_at_less_than: '2016-08-30' ) filter = DateFilter.new(search, 'placed_at', :gte) assert_equal(Time.zone.local(2016, 8, 26), filter.query_value) filter = DateFilter.new(search, 'placed_at', :lt) assert_equal(Time.zone.local(2016, 8, 30).end_of_day, filter.query_value) search = AdminOrders.new( placed_at_greater_than: '2016-08-26', placed_at_less_than: '2016-08-26' ) filter = DateFilter.new(search, 'placed_at', :gte) assert_equal(Time.zone.local(2016, 8, 26), filter.query_value) filter = DateFilter.new(search, 'placed_at', :lt) assert_equal(Time.zone.local(2016, 8, 26).end_of_day, filter.query_value) end def test_time_specified? search = AdminOrders.new(placed_at_greater_than: '2016-08-26') refute(DateFilter.new(search, 'placed_at', :gte).time_specified?) search = AdminOrders.new(placed_at_greater_than: '2019-03-06T14:00:00-05:00') assert(DateFilter.new(search, 'placed_at', :gte).time_specified?) end end end end
Version data entries
62 entries across 62 versions & 1 rubygems