mirror of
https://github.com/plashchynski/crono.git
synced 2026-06-12 01:34:25 +02:00
Rename to Crono
This commit is contained in:
+3
-3
@@ -1,8 +1,8 @@
|
||||
require "spec_helper"
|
||||
require 'periodicity/cli'
|
||||
require 'crono/cli'
|
||||
|
||||
describe Periodicity::CLI do
|
||||
let(:cli) { Periodicity::CLI.instance }
|
||||
describe Crono::CLI do
|
||||
let(:cli) { Crono::CLI.instance }
|
||||
|
||||
describe "#run" do
|
||||
it "should try to initialize rails with #load_rails" do
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe Periodicity::Config do
|
||||
describe Crono::Config do
|
||||
describe "#initialize" do
|
||||
it "should initialize schedule with an empty array" do
|
||||
@config = Periodicity::Config.instance
|
||||
@config = Crono::Config.instance
|
||||
expect(@config.schedule).to eql([])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,9 +5,9 @@ class TestJob < ActiveJob::Base
|
||||
def perform;end
|
||||
end
|
||||
|
||||
describe Periodicity::PerformerProxy do
|
||||
describe Crono::PerformerProxy do
|
||||
it "should add job and period to schedule" do
|
||||
Periodicity.perform(TestJob).every(2.days, at: "15:30")
|
||||
expect(Periodicity::Config.instance.schedule).to_not be_empty
|
||||
Crono.perform(TestJob).every(2.days, at: "15:30")
|
||||
expect(Crono::Config.instance.schedule).to_not be_empty
|
||||
end
|
||||
end
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ require 'bundler/setup'
|
||||
Bundler.setup
|
||||
|
||||
require 'timecop'
|
||||
require 'periodicity'
|
||||
require 'crono'
|
||||
|
||||
RSpec.configure do |config|
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user