Permalink
Browse files

add SubRangeIterator#cover?; fix typo in tests

  • Loading branch information...
1 parent 086c449 commit c26e76054075e4a5eec6db7ae1d6da2977a8cd28 @ericgj committed Feb 16, 2012
Showing with 7 additions and 3 deletions.
  1. +5 −1 lib/tempr/date_time_range.rb
  2. +2 −2 test/time_subrange.rb
@@ -511,6 +511,10 @@ def except(&p)
self
end
+ def cover?(dt)
+ any? {|r| r.cover?(dt)}
+ end
+
# Recursive madness...
# note this could possibly use cached results stored by #all method,
# similar to Sequel
@@ -596,5 +600,5 @@ def exception_procs; @exception_procs ||= []; end
subrange = range.each_month.thursday(2).at_time('2:00pm',60*60)
pp subrange.to_a
-
+
end
@@ -215,7 +215,7 @@ module Expected
last_result
end
- it 'each_minutes must return ranges starting up to 23:00:00 of the end date' do
+ it 'each_hours must return ranges starting up to 23:00:00 of the end date' do
last_result = subject.each_hours.to_a.last
assert_equal ( (Fixtures::ExclusiveDateRange.end.to_time - 60*60)...
Fixtures::ExclusiveDateRange.end.to_time ),
@@ -242,7 +242,7 @@ module Expected
last_result
end
- it 'each_minutes must return ranges starting up to 23:00:00 of the end date + 1' do
+ it 'each_hours must return ranges starting up to 23:00:00 of the end date + 1' do
last_result = subject.each_hours.to_a.last
assert_equal ( ((Fixtures::NonExclusiveDateRange.end+1).to_time - 60*60)...
(Fixtures::NonExclusiveDateRange.end+1).to_time ),

0 comments on commit c26e760

Please sign in to comment.