add config class and schedule

This commit is contained in:
Dzmitry Plashchynski
2015-03-02 20:28:13 +02:00
parent 6bf168e627
commit 283dd446a3
7 changed files with 41 additions and 2 deletions

10
spec/config_spec.rb Normal file
View File

@@ -0,0 +1,10 @@
require "spec_helper"
describe Periodicity::Config do
describe "#initialize" do
it "should initialize schedule with an empty array" do
@config = Periodicity::Config.instance
expect(@config.schedule).to eql([])
end
end
end

View File

@@ -0,0 +1,16 @@
require "spec_helper"
class TestJob < ActiveJob::Base
def perform;end
end
TestJob.extend(Periodicity::Extensions::ActiveJob)
describe Periodicity::Extensions::ActiveJob do
describe "#perform_every" do
it "should add job and period to schedule" do
TestJob.perform_every(1.second)
expect(Periodicity::Config.instance.schedule).to_not be_empty
end
end
end

View File

@@ -1,6 +1,7 @@
require 'bundler/setup'
Bundler.setup
require 'active_job'
require 'timecop'
require 'periodicity'