Skip to content

Commit

Permalink
Fix a weird bug with Rails <= 7.1 where performed_jobs was being zero…
Browse files Browse the repository at this point in the history
…ed out during a test simulation

This appears to be due to `queue_adapter_for_test` being set to a fresh instance of the test adapter, such that a new state for performed_jobs was now present.
  • Loading branch information
fractaledmind committed Dec 17, 2024
1 parent dce40cc commit ec8794c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,12 @@ def before_setup

def after_teardown; end
end

class ActiveJob::TestCase
# This needs to be set to `nil` to avoid an odd bug in Rails <= 7.1
# where the queue adapter is given a fresh instance of the test adapter
# after the `after_teardown` hook is called.
def queue_adapter_for_test
nil
end
end

0 comments on commit ec8794c

Please sign in to comment.