From 20e7adedd87e55cae667119408ad6967f5ca020c Mon Sep 17 00:00:00 2001 From: Adam Lassek Date: Wed, 24 Jun 2026 23:25:12 -0500 Subject: [PATCH] Provide a way to prevent db command re-runs for test --- lib/hanami/cli/commands/app/db/command.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/hanami/cli/commands/app/db/command.rb b/lib/hanami/cli/commands/app/db/command.rb index 3c895484..890b497a 100644 --- a/lib/hanami/cli/commands/app/db/command.rb +++ b/lib/hanami/cli/commands/app/db/command.rb @@ -179,6 +179,9 @@ def re_run_development_command_in_test # Re-runs in test are for development-env commands only. return unless Hanami.env == :development + # Re-runs have been intentionally switched off + return if ENV.fetch("HANAMI_CLI_DB_COMMAND_RE_RUN_IN_TEST", "true") != "true" + cmd = $0 cmd = "bundle exec #{cmd}" if ENV.key?("BUNDLE_BIN_PATH") @@ -192,7 +195,7 @@ def re_run_development_command_in_test end def re_running_in_test? - ENV.key?("HANAMI_CLI_DB_COMMAND_RE_RUN_IN_TEST") + ENV["HANAMI_CLI_DB_COMMAND_RE_RUN_IN_TEST"] == "true" end # Returns the `ARGV` with every option argument included, but the `-e` or `--env` args