Skip to content

Instantly share code, notes, and snippets.

@alpaca-tc
Created May 23, 2021 12:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
sidekiq-cronのconfig/schedule.ymlがvalidであることをテスト
# frozen_string_literal: true
RSpec.describe 'sidekiq-cron' do
describe 'config/schedule.yml' do
let(:path) { Rails.root.join('config', 'schedule.yml') }
before do
Sidekiq::Cron::Job.load_from_array(YAML.load_file(path))
end
it 'is valid' do
expect(Sidekiq::Cron::Job.all).to all(be_valid)
matcher = satisfy do |job|
klass = job.klass.constantize
klass < Sidekiq::Worker || klass < ActiveJob::Base
end
expect(Sidekiq::Cron::Job.all).to all(matcher)
end
it 'is localized' do
Sidekiq::Cron::Job.all.each do |job|
cron = Fugit.do_parse_cron(job.cron)
expect(cron.zone).to eq(Time.zone.name)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment