4 class TestRepeaterDayName < Test::Unit::TestCase
7 @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
11 token = Chronic::Token.new('saturday')
12 repeater = Chronic::Repeater.scan_for_day_names(token)
13 assert_equal Chronic::RepeaterDayName, repeater.class
14 assert_equal :saturday, repeater.type
16 token = Chronic::Token.new('sunday')
17 repeater = Chronic::Repeater.scan_for_day_names(token)
18 assert_equal Chronic::RepeaterDayName, repeater.class
19 assert_equal :sunday, repeater.type
23 mondays = Chronic::RepeaterDayName.new(:monday)
26 span = mondays.next(:future)
28 assert_equal Time.local(2006, 8, 21), span.begin
29 assert_equal Time.local(2006, 8, 22), span.end
31 span = mondays.next(:future)
33 assert_equal Time.local(2006, 8, 28), span.begin
34 assert_equal Time.local(2006, 8, 29), span.end
38 mondays = Chronic::RepeaterDayName.new(:monday)
41 span = mondays.next(:past)
43 assert_equal Time.local(2006, 8, 14), span.begin
44 assert_equal Time.local(2006, 8, 15), span.end
46 span = mondays.next(:past)
48 assert_equal Time.local(2006, 8, 7), span.begin
49 assert_equal Time.local(2006, 8, 8), span.end