Skip to content

Instantly share code, notes, and snippets.

@KazuCocoa
Created April 29, 2016 03:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KazuCocoa/75a5c184957231fcc470b60cce8570bc to your computer and use it in GitHub Desktop.
Save KazuCocoa/75a5c184957231fcc470b60cce8570bc to your computer and use it in GitHub Desktop.
defmodule MyApp.IntegrationCase do
use ExUnit.CaseTemplate
using do
quote do
use Hound.Helpers
import Ecto
import Ecto.Changeset
import Ecto.Query
import MyApp.Router.Helpers
alias MyApp.Repo
# The default endpoint for testing
@endpoint MyApp.Endpoint
# run tests only "integration" mode
@moduletag :integration
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(MyApp.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(MyApp.Repo, {:shared, self()})
end
metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for(MyApp.Repo, self())
Hound.start_session(metadata: metadata)
:ok
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment