fix: correct test setup bugs found by actually running the suite

Set up a working Docker-based Rails environment (this session's shell
had no compatible Ruby/Bundler) and ran the full suite against PR #3298.
Two real bugs surfaced that static checks couldn't have caught:

- WorkerAiHealth::Snapshot.new(**{...}.merge(overrides)) needs the
  double-splat -- a bare Hash isn't auto-converted to keyword arguments.
  Both test snapshot builders passed a positional Hash instead, which
  raised "missing keywords" for every field on every call.
- assert_enqueued_with/assert_no_enqueued_jobs need `include
  ActiveJob::TestHelper` explicitly in a plain ActiveSupport::TestCase --
  every other model test in this codebase that uses them does the same;
  I'd wrongly assumed it was available process-wide.

With both fixed: 7510 runs, 29877 assertions, 0 failures, 0 errors, 30
skips for the full suite; rubocop, erb_lint, and brakeman all clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9494Pxh4LZKnNLTGfFXPw
This commit is contained in:
Jonathan Kaiser
2026-09-02 07:15:54 +02:00
committed by Juan José Mata
co-authored by Claude Sonnet 5
parent b9b5a7c58b
commit 9906dd7b09
2 changed files with 4 additions and 2 deletions
@@ -481,7 +481,7 @@ class Admin::SystemHealthControllerTest < ActionDispatch::IntegrationTest
def worker_snapshot(overrides = {})
WorkerAiHealth::Snapshot.new(
{
**{
process_identity: "worker:1",
hostname: "worker",
pid: 1,
+3 -1
View File
@@ -1,6 +1,8 @@
require "test_helper"
class WorkerAiHealthTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
@cache = ActiveSupport::Cache::MemoryStore.new
end
@@ -149,7 +151,7 @@ class WorkerAiHealthTest < ActiveSupport::TestCase
private
def passing_snapshot(overrides = {})
WorkerAiHealth::Snapshot.new(
{
**{
process_identity: "host:1",
hostname: "host",
pid: 1,