aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_ext_test.rb
blob: 63a0cf5e6dcba9bb57d269e3f5ab60ba8b96c3f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'test/unit'
require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/date'

class DateExtCalculationsTest < Test::Unit::TestCase
  def test_to_s
    assert_equal "21 Feb",            Date.new(2005, 2, 21).to_s(:short)
    assert_equal "February 21, 2005", Date.new(2005, 2, 21).to_s(:long)
  end
  
  def test_to_time
    assert_equal Time.local(2005, 2, 21), Date.new(2005, 2, 21).to_time
  end
  
  def test_to_date
    assert_equal Date.new(2005, 2, 21), Date.new(2005, 2, 21).to_date
  end
end