Sha256: cc6179a857392cfa90d3eec59e711d9a1f6c4d51de85b33a8f6084423dd43fd5
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
# -*- coding: utf-8 -*- require 'simplecov' SimpleCov.start require 'test/unit' require 'sixarm_ruby_date_age' class DateAgeTest < Test::Unit::TestCase # for test_age_years and test_age_days BIRTHDATE = Date.new(1980,10,31) VALENTINES = Date.new(2011,02,14) HALLOWEEN = Date.new(2011,10,31) NEW_YEARS_EVE = Date.new(2011,12,31) def test_age_in_days assert_equal(11063,BIRTHDATE.age_in_days(VALENTINES), '< birthday') assert_equal(11322,BIRTHDATE.age_in_days(HALLOWEEN), '= birthday') assert_equal(11383,BIRTHDATE.age_in_days(NEW_YEARS_EVE), '> birthday') end def test_age_in_days_with_non_date assert_raise(ArgumentError){ BIRTHDATE.age_in_days('') } end def test_age_in_days_alias assert_equal(BIRTHDATE.age_in_days(VALENTINES), BIRTHDATE.age_in_days_on(VALENTINES)) end def test_age_in_years assert_equal(30,BIRTHDATE.age_in_years(VALENTINES), '< birthday') assert_equal(31,BIRTHDATE.age_in_years(HALLOWEEN), '= birthday') assert_equal(31,BIRTHDATE.age_in_years(NEW_YEARS_EVE), '> birthday') end def test_age_in_years_with_non_date assert_raise(ArgumentError){ BIRTHDATE.age_in_years('') } end def test_age_in_years_alias assert_equal(BIRTHDATE.age_in_years(VALENTINES), BIRTHDATE.age_in_years_on(VALENTINES)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sixarm_ruby_date_age-1.1.0 | test/sixarm_ruby_date_age_test.rb |