#1482·hanami

Hanami::DB::Testing.database_url should apply to explicitly configured database URLs, not just ENV-detected URLs

Author: timrileyCreated Dec 1, 2024Updated Dec 2, 2024

If you configure your database URL like so (i.e. not using a DATABASE_URL or similar ENV var):

ruby
Hanami.app.configure_provider :db do
  config.gateway :default do |gw|
    gw.database_url = "postgres://postgres@localhost/my_app"
  end
end

Then the URL will not be automatically converted to my_app_test when the app is run in the test environment.

We should apply the Hanami::DB::Testing.database_url transformation to database URLs across all gateways, not just when we're detecting database URLs from the ENV.