require 'test/unit'
require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/date'
require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/time'
require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/range'

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
