diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-09 17:52:42 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-09 17:52:42 +0000 |
commit | 5ef931a4b879ed2f380b393000edbdb4c50f8150 (patch) | |
tree | 155b090e0059303d0b4a14a94ce0032ee87af2d4 /activesupport/test/core_ext | |
parent | 2ed689745c14f7f02e5e4a970240e206dcee1b33 (diff) | |
download | rails-5ef931a4b879ed2f380b393000edbdb4c50f8150.tar.gz rails-5ef931a4b879ed2f380b393000edbdb4c50f8150.tar.bz2 rails-5ef931a4b879ed2f380b393000edbdb4c50f8150.zip |
Added to_s(:db) to Range
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2506 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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 |