Skip to content

Instantly share code, notes, and snippets.

@alpaca-tc
Created May 23, 2021 12:59
Show Gist options
  • Save alpaca-tc/78842345cefaa55a827da15091a9cde3 to your computer and use it in GitHub Desktop.
Save alpaca-tc/78842345cefaa55a827da15091a9cde3 to your computer and use it in GitHub Desktop.
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