Check period duration to be at least 1 day when using 'at'

This commit is contained in:
Dzmitry Plashchynski
2015-03-15 09:56:18 +02:00
parent 6508197f26
commit 95a237aeb5
2 changed files with 7 additions and 0 deletions

View File

@@ -78,6 +78,12 @@ describe Crono::Period do
}.to raise_error("Unknown 'at' format")
end
it 'should raise error when period is less than 1 day' do
expect {
Crono::Period.new(5.hours, at: '15:30')
}.to raise_error("period should be at least 1 day to use 'at'")
end
it 'should return time in relation to last time' do
@period = Crono::Period.new(2.day)
expect(@period.next(since: 1.day.ago)).to be_eql(1.day.from_now)