Skip to content

Record and replay

sh
ruby-anything app record <repo> --http --inputs rails/port/app-cases/inputs.jsonl \
  --db-reset "<command that resets the test database>" -- <command that starts the original>
ruby-anything app replay <repo> --original     # the original must pass its own recording 100%

The start command reads PORT or uses {port} (--port if it is fixed). GET routes without parameters are discovered from the code; everything else comes from inputs.jsonl ({"name", "method", "path", "headers", "body"} per line).

Each case saves the status, redirects, JSON and page text. Every GET runs twice: values that change between runs become [..] wildcards.

Side effects

A port that forgets to charge the card or send the receipt must fail:

sh
ruby-anything app record <repo> --http --inputs ... \
  --effect-env PAYMENT_API_URL=http,SMTP_HOST=smtp_host,SMTP_PORT=smtp_port \
  --db-dump "sqlite3 db.sqlite3 .dump" --db-reset "<reset command>" -- <start command>

--effect-env NAME=KIND points the app's own setting at a local stand-in that records every call: http, smtp, smtp_host and smtp_port. --db-dump runs after every non-GET request, and its rows are part of the case. Replay sets the same variables for the Rails app, which must read them too.

CLI apps

sh
ruby-anything app record <repo> --cli --inputs rails/port/app-cases/cli.jsonl -- python tool.py

List invocations in cli.jsonl ({"name", "args": [...], "stdin", "env"}). Each runs twice in a throwaway copy of the repo; exit code, stdout, stderr and the files it writes are the case.

Replay

sh
ruby-anything app replay <repo>               # every case through Rails
ruby-anything app replay <repo> --case <name> # one case

Pages are compared by visible text, so the markup is new but every heading, label, price and empty state must still be there. JSON must match exactly.

Edit this page on GitHub →