0
votes

I'm considering migrating my Elixir/Phoenix project tests from ExUnit to espec_phoenix.

When I have a test database set up before running the tests, it's working as expected.

But when I don't, I get an error:

12:04:27.581 [error] Postgrex.Protocol (#PID<0.433.0>) failed to connect: ** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name): database "my_project_test" does not exist

I'd like espec_phoenix to set the DB up for me, just as ExUnit did.

Any ideas how?

1

1 Answers

1
votes

ExUnit did not do anything with a database. This is mix’s alias who did:

defp aliases do
  [
    ...
    "test": ["ecto.create --quiet", "ecto.migrate", "test"]
  ]
end

I believe espec_phoenix uses different task name, so, just alias it as following:

    #            or how the original task is called  ⇓⇓⇓⇓⇓⇓⇓
    "espec": ["ecto.create --quiet", "ecto.migrate", "espec"]