2007-02-09 09:04:31 +01:00
|
|
|
require File.dirname(__FILE__) + '/../abstract_unit'
|
2007-01-22 14:43:50 +01:00
|
|
|
|
|
|
|
class RangeTest < Test::Unit::TestCase
|
|
|
|
def test_to_s_from_dates
|
|
|
|
date_range = Date.new(2005, 12, 10)..Date.new(2005, 12, 12)
|
|
|
|
assert_equal "BETWEEN '2005-12-10' AND '2005-12-12'", date_range.to_s(:db)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_to_s_from_times
|
|
|
|
date_range = Time.utc(2005, 12, 10, 15, 30)..Time.utc(2005, 12, 10, 17, 30)
|
|
|
|
assert_equal "BETWEEN '2005-12-10 15:30:00' AND '2005-12-10 17:30:00'", date_range.to_s(:db)
|
|
|
|
end
|
|
|
|
end
|