Sha256: a044e3ee9ec71bf9ac7543d8370827f0bc27d8cffc3315da9e1d863e0ae177a9
Contents?: true
Size: 1.88 KB
Versions: 4
Compression:
Stored size: 1.88 KB
Contents
$TESTING = true ENV['RACK_ENV'] = 'test' require 'simplecov' SimpleCov.start do add_filter "/test/" add_group 'SidekiqCron', 'lib/' end require "minitest/autorun" require "rack/test" require 'mocha/minitest' require 'sidekiq' require "sidekiq-pro" if ENV['SIDEKIQ_PRO_VERSION'] require 'sidekiq/web' Sidekiq.logger.level = Logger::ERROR redis_url = ENV['REDIS_URL'] || 'redis://0.0.0.0:6379' REDIS = Sidekiq::RedisConnection.create(:url => redis_url, :namespace => 'testy') Sidekiq.configure_client do |config| config.redis = { :url => redis_url, :namespace => 'testy' } end require 'sidekiq-cron' require 'sidekiq/cron/web' # For testing os symbilize args! class Hash def symbolize_keys transform_keys { |key| key.to_sym rescue key } end end class CronTestClass include Sidekiq::Worker sidekiq_options retry: true def perform args = {} puts "super croned job #{args}" end end class CronTestClassWithQueue include Sidekiq::Worker sidekiq_options queue: :super, retry: false, backtrace: true def perform args = {} puts "super croned job #{args}" end end module ActiveJob class Base attr_accessor *%i[job_class provider_job_id queue_name arguments] def initialize yield self if block_given? self.provider_job_id ||= SecureRandom.hex(12) end def self.queue_name_prefix @queue_name_prefix end def self.queue_name_prefix=(queue_name_prefix) @queue_name_prefix = queue_name_prefix end def self.set(options) @queue = options['queue'] self end def try(method, *args, &block) send method, *args, &block if respond_to? method end def self.perform_later(*args) new do |instance| instance.job_class = self.class.name instance.queue_name = @queue instance.arguments = [*args] end end end end class ActiveJobCronTestClass < ActiveJob::Base end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-cron-1.6.0 | test/test_helper.rb |
sidekiq-cron-1.5.1 | test/test_helper.rb |
sidekiq-cron-1.5.0 | test/test_helper.rb |
sidekiq-cron-1.4.0 | test/test_helper.rb |