Good morning,
I have some particularly expensive database setup code in my Elixir project that inserts required data into the database.
I currently have my tests working such that this data is inserted prior to any tests that need it via a @tag :insert_my_data
construct. I have code in my test helper that does something like:
setup tags do
if tags[:insert_my_data] do
# Run code here
end
end
The problem with this is that I'm having to run this code hundreds of times, and it is slow.
What would work better was if the code ran once automatically, prior to any invocation of mix test
, and the transaction rollback functionality provided by Ecto would reset to this known state (rather than an empty database).
How can I accomplish this?
Thanks!