mirror of
https://github.com/plashchynski/crono.git
synced 2026-11-19 15:08:17 +01:00
Add Period#description
This commit is contained in:
1 parent
527f4768bc
commit
5b66e9049b
2 files changed
+13
No files matched your search
@@ -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