Skip to content

Commit 524a159

Browse files
committed
Conditionally defined method for priority
1 parent ab6e6e8 commit 524a159

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/rspec/rails/matchers/active_job.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,14 @@ def job_matches?(job)
168168
end
169169

170170
# Rails 6.1 serializes the priority with a string key
171-
def fetch_priority(job)
172-
job[:priority] || job['priority']
171+
if ::Rails.version.to_f >= 7
172+
def fetch_priority(job)
173+
job[:priority]
174+
end
175+
else
176+
def fetch_priority(job)
177+
job['priority']
178+
end
173179
end
174180

175181
def arguments_match?(job)

0 commit comments

Comments
 (0)