diff options
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/range_ext_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb new file mode 100644 index 0000000000..49cbb10be6 --- /dev/null +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -0,0 +1,16 @@ +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 |