Rename to Crono

This commit is contained in:
Dzmitry Plashchynski
2015-03-03 13:51:40 +02:00
parent 6b185c44ac
commit 3652e9525a
18 changed files with 45 additions and 45 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
require "spec_helper"
describe Periodicity::Period do
describe Crono::Period do
around(:each) do |example|
Timecop.freeze do
example.run
@@ -10,24 +10,24 @@ describe Periodicity::Period do
describe "#next" do
context "in daily basis" do
it "should return the time 2 days from now" do
@period = Periodicity::Period.new(2.day)
@period = Crono::Period.new(2.day)
expect(@period.next).to be_eql(2.day.from_now)
end
it "should set time to 'at' time as a string" do
@period = Periodicity::Period.new(2.day, at: "15:20")
@period = Crono::Period.new(2.day, at: "15:20")
expect(@period.next).to be_eql(2.day.from_now.change(hour: 15, min: 20))
end
it "should set time to 'at' time as a hash" do
at = {hour: 18, min: 45}
@period = Periodicity::Period.new(2.day, at: at)
@period = Crono::Period.new(2.day, at: at)
expect(@period.next).to be_eql(2.day.from_now.change(at))
end
it "should raise error when 'at' is wrong" do
expect {
@period = Periodicity::Period.new(2.day, at: 1)
@period = Crono::Period.new(2.day, at: 1)
}.to raise_error("Unknown 'at' format")
end
end