Skip to content

Instantly share code, notes, and snippets.

@sorentwo
Last active August 29, 2015 14:16
Show Gist options
  • Save sorentwo/9c9c7aab4b9ae8795aa7 to your computer and use it in GitHub Desktop.
Save sorentwo/9c9c7aab4b9ae8795aa7 to your computer and use it in GitHub Desktop.
Transactional Tests
defmodule CustomTest.Case do
use ExUnit.CaseTemplate
alias Ecto.Adapters.SQL
setup_all do
SQL.begin_test_transaction(Repo)
on_exit fn ->
SQL.rollback_test_transaction(Repo)
end
end
setup do
SQL.restart_test_transaction(Repo)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment