mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-25 10:52:28 +01:00
Add Period#description
This commit is contained in:
@@ -10,6 +10,12 @@ module Crono
|
||||
@period.since(since).change({hour: @at_hour, min: @at_min}.compact)
|
||||
end
|
||||
|
||||
def description
|
||||
desc = "every #{@period.inspect}"
|
||||
desc += " at #{@at_hour}:#{@at_min}" if @at_hour && @at_min
|
||||
desc
|
||||
end
|
||||
|
||||
def parse_at(at)
|
||||
case at
|
||||
when String
|
||||
|
||||
@@ -7,6 +7,13 @@ describe Crono::Period do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#description" do
|
||||
it "should return period description" do
|
||||
@period = Crono::Period.new(2.day, at: "15:20")
|
||||
expect(@period.description).to be_eql("every 2 days at 15:20")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#next" do
|
||||
context "in daily basis" do
|
||||
it "should return the time 2 days from now" do
|
||||
|
||||
Reference in New Issue
Block a user