Created
May 23, 2021 12:59
-
-
Save alpaca-tc/78842345cefaa55a827da15091a9cde3 to your computer and use it in GitHub Desktop.
sidekiq-cronのconfig/schedule.ymlがvalidであることをテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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