Sha256: d482d692414dc57afeffac57673a63da7071a400911ca344930caafe6a050349

Contents?: true

Size: 782 Bytes

Versions: 3

Compression:

Stored size: 782 Bytes

Contents

# Test facets/date.rb

require 'facets/date.rb'
require 'test/unit'

class TC_Date < Test::Unit::TestCase

  def setup
    @d = Date.civil( 2005, 04, 20 )
  end

  def test_to_date
    assert_instance_of( ::Date, @d.to_date )
  end

  def test_to_time
    assert_instance_of( ::Time, @d.to_time )
  end

  def test_to_s
    assert_equal( "2005-04-20", @d.to_s )
  end


  def test_stamp_1
    assert_equal( "2005-04-20", @d.stamp )
  end

  def test_stamp_2
    assert_equal( "20 Apr", @d.stamp(:short) )
  end

  def test_stamp_3
    assert_equal( "April 20, 2005", @d.stamp(:long) )
  end

  def test_days_in_month
    assert_equal( 31, Date.new(2004,1,1).days_in_month )
  end

  def test_days_of_month
    assert_equal( (1..@d.days_in_month).to_a, @d.days_of_month )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.1.3 test/unit/test_date.rb
facets-2.2.0 test/unit/test_date.rb
facets-2.2.1 test/unit/test_date.rb