Skip to content

Commit

Permalink
Make test expectations about backtraces pass in Ruby 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebarrie committed Jan 22, 2025
1 parent c95d481 commit e6d9905
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/jobs/maintenance_tasks/task_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class TaskJobTest < ActiveJob::TestCase

assert_equal "ArgumentError", run.error_class
assert_equal "Something went wrong", run.error_message
expected_backtrace = "app/tasks/maintenance/error_task.rb:10:in `process'"
expected_backtrace = %r{app/tasks/maintenance/error_task\.rb:10:in ('Maintenance::ErrorTask#|`)process'}
assert_match expected_backtrace, run.backtrace.first
assert_equal Time.now, run.ended_at
assert_equal "1", run.cursor
Expand Down Expand Up @@ -511,7 +511,7 @@ class << self

# Simulate cancel happening after we've already checked @run.cancelling?
@run.expects(:cancelling?).at_least(2).with do
next true if caller.any?(/`instrument_status_change'\z/) # avoid endless loop
next true if caller.any?(/\binstrument_status_change'\z/) # avoid endless loop

Run.find(@run.id).cancel
end.returns(false).then.returns(true)
Expand All @@ -526,7 +526,7 @@ class << self

# Simulate pause happening after we've already checked @run.pausing?
@run.expects(:pausing?).at_least(2).with do
next true if caller.any?(/`instrument_status_change'\z/) # avoid endless loop
next true if caller.any?(/\binstrument_status_change'\z/) # avoid endless loop

Run.find(@run.id).pausing!
end.returns(false).then.returns(true)
Expand Down

0 comments on commit e6d9905

Please sign in to comment.