module ScheduleQueueHelper
Public Instance Methods
check_for_scheduled(actual, expected_args)
click to toggle source
# File lib/activejob_spec/matchers.rb, line 48 def check_for_scheduled(actual, expected_args) scheduled_jobs.any? do |entry| class_matches = match_job(entry, actual) args_match = match_args(expected_args, entry.fetch(:args)) class_matches && args_match && time_matches(entry) end end
compare_interval(entry)
click to toggle source
# File lib/activejob_spec/matchers.rb, line 68 def compare_interval(entry) entry[:at].to_i == (Time.now + @interval).to_i end
compare_time(entry)
click to toggle source
# File lib/activejob_spec/matchers.rb, line 64 def compare_time(entry) entry[:at].to_i == @time.to_i end
scheduled_jobs()
click to toggle source
# File lib/activejob_spec/matchers.rb, line 72 def scheduled_jobs enqueued_jobs.select { |job| job.key?(:at) } end
scheduled_size_for(actual)
click to toggle source
# File lib/activejob_spec/matchers.rb, line 76 def scheduled_size_for(actual) scheduled_jobs.select { |job| match_job(job, actual) }.size end
time_matches(entry)
click to toggle source
# File lib/activejob_spec/matchers.rb, line 57 def time_matches(entry) return compare_time(entry) if @time return compare_interval(entry) if @interval true end