From b27cdc97c73829d9ca5da3e611e38ecb514f20b7 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Tue, 13 Aug 2024 14:05:10 -0400 Subject: [PATCH] Handle ruby 3.4 message expectation --- lib/delayed/backend/shared_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/delayed/backend/shared_spec.rb b/lib/delayed/backend/shared_spec.rb index 39f497670..b773666f8 100644 --- a/lib/delayed/backend/shared_spec.rb +++ b/lib/delayed/backend/shared_spec.rb @@ -595,7 +595,12 @@ def create_job(opts = {}) worker.work_off @job.reload expect(@job.last_error).to match(/did not work/) - expect(@job.last_error).to match(/sample_jobs.rb:\d+:in `perform'/) + if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.4.0') + # Ruby 3.4 produces a more verbose message + expect(@job.last_error).to match(/sample_jobs.rb:\d+:in 'ErrorJob#perform'/) + else + expect(@job.last_error).to match(/sample_jobs.rb:\d+:in `perform'/) + end expect(@job.attempts).to eq(1) expect(@job.run_at).to be > Delayed::Job.db_time_now - 10.minutes expect(@job.run_at).to be < Delayed::Job.db_time_now + 10.minutes