Testcontainers::PostgresContainer
Inherits Testcontainers::DockerContainer < Reference < Object
PostgresContainer provides a pre-configured container for PostgreSQL.
Example:
container = Testcontainers::PostgresContainer.new
container.start
url = container.database_url
# => "postgres://test:test@localhost:32768/test"
container.stop
container.remove
Constants
POSTGRES_DEFAULT_DATABASE = "test"
POSTGRES_DEFAULT_IMAGE = "postgres:latest"
POSTGRES_DEFAULT_PASSWORD = "test"
POSTGRES_DEFAULT_PORT = 5432
POSTGRES_DEFAULT_USERNAME = "test"
Constructors
Instance methods
database
Sourcedatabase_url(protocol : String = "postgres", username : String | Nil = nil, password : String | Nil = nil, database : String | Nil = nil, options : Hash(String, String) = Hash(String, String).new) : String
Returns the database URL.
Example: "postgres://user:password@localhost:5432/dbname"
password
Sourceusername
Source