Module: QueueHelper
- Includes:
- ActiveJobHelper, ArgsHelper
- Included in:
- ScheduleQueueHelper
- Defined in:
- lib/activejob_spec/matchers.rb
Instance Method Summary collapse
- #check_size_for(matched_jobs, times) ⇒ Object
- #find_matching_jobs(actual, expected_args) ⇒ Object
- #queue_size_for(actual) ⇒ Object
Methods included from ActiveJobHelper
Methods included from ArgsHelper
Instance Method Details
#check_size_for(matched_jobs, times) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/activejob_spec/matchers.rb', line 36 def check_size_for(matched_jobs, times) if times matched_jobs.size == times else matched_jobs.size > 0 end end |
#find_matching_jobs(actual, expected_args) ⇒ Object
26 27 28 29 30 |
# File 'lib/activejob_spec/matchers.rb', line 26 def find_matching_jobs(actual, expected_args) enqueued_jobs.select do |entry| match_job(entry, actual) && match_args(expected_args, entry.fetch(:args)) end end |
#queue_size_for(actual) ⇒ Object
32 33 34 |
# File 'lib/activejob_spec/matchers.rb', line 32 def queue_size_for(actual) enqueued_jobs.select { |job| match_job(job, actual) }.size end |