mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-29 05:42:02 +02:00
Refactor to remove global variables
This commit is contained in:
@@ -31,17 +31,17 @@ describe Crono::CLI do
|
||||
describe "#parse_options" do
|
||||
it "should set cronotab" do
|
||||
cli.send(:parse_options, ["--cronotab", "/tmp/cronotab.rb"])
|
||||
expect(Crono.config.cronotab).to be_eql "/tmp/cronotab.rb"
|
||||
expect(cli.config.cronotab).to be_eql "/tmp/cronotab.rb"
|
||||
end
|
||||
|
||||
it "should set logfile" do
|
||||
cli.send(:parse_options, ["--logfile", "log/crono.log"])
|
||||
expect(Crono.config.logfile).to be_eql "log/crono.log"
|
||||
expect(cli.config.logfile).to be_eql "log/crono.log"
|
||||
end
|
||||
|
||||
it "should set daemonize" do
|
||||
cli.send(:parse_options, ["--daemonize"])
|
||||
expect(Crono.config.daemonize).to be true
|
||||
expect(cli.config.daemonize).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,8 +3,10 @@ require "spec_helper"
|
||||
describe Crono::Config do
|
||||
describe "#initialize" do
|
||||
it "should initialize schedule" do
|
||||
@config = Crono.config
|
||||
expect(@config.schedule).to be_a(Crono::Schedule)
|
||||
@config = Crono::Config.new
|
||||
expect(@config.cronotab).to be Crono::Config::CRONOTAB
|
||||
expect(@config.logfile).to be Crono::Config::LOGFILE
|
||||
expect(@config.daemonize).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe Crono::Logger do
|
||||
describe "#initialize" do
|
||||
it "should initialize logger" do
|
||||
expect {
|
||||
Crono.logger.info("Test")
|
||||
}.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,7 +6,7 @@ end
|
||||
|
||||
describe Crono::PerformerProxy do
|
||||
it "should add job and period to schedule" do
|
||||
expect(Crono.config.schedule).to receive(:add).with(TestJob, kind_of(Crono::Period))
|
||||
expect(Crono.schedule).to receive(:add).with(TestJob, kind_of(Crono::Period))
|
||||
Crono.perform(TestJob).every(2.days, at: "15:30")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user