diff --git a/lib/rspec/rails/matchers/active_job.rb b/lib/rspec/rails/matchers/active_job.rb index 320ece90e..583f56faf 100644 --- a/lib/rspec/rails/matchers/active_job.rb +++ b/lib/rspec/rails/matchers/active_job.rb @@ -168,8 +168,14 @@ def job_matches?(job) end # Rails 6.1 serializes the priority with a string key - def fetch_priority(job) - job[:priority] || job['priority'] + if ::Rails.version.to_f >= 7 + def fetch_priority(job) + job[:priority] + end + else + def fetch_priority(job) + job['priority'] + end end def arguments_match?(job)