Added #until's sister method, #from.

This commit is contained in:
2010-07-29 14:26:31 +03:00
parent 3e6b637f75
commit c7e46c25d1
2 changed files with 18 additions and 1 deletions

View File

@@ -60,4 +60,10 @@ describe "Time Iterations" do
@now.until(@now - 6.hours).map_each(:hour) { |time| time }.should == match
end
it "should iterate over time objects with #map_each and #from via method chaining" do
match = (1..6).map { |i| @now + i.hours }
(@now + 6.hours).map_each_hour.from(@now) { |time| time }.should == match
(@now + 6.hours).from(@now).map_each(:hour) { |time| time }.should == match
end
end