Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
riverrun committed Feb 25, 2017
1 parent 5f8a706 commit a43a208
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
19 changes: 19 additions & 0 deletions test/support/ecto_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,22 @@ defmodule Openmaize.TestUser do
|> Openmaize.Database.add_confirm_token(key)
end
end

defmodule Openmaize.TestCase do
use ExUnit.CaseTemplate

setup do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(TestRepo)
end
end

{:ok, _} = Ecto.Adapters.Postgres.ensure_all_started(TestRepo, :temporary)

#_ = Ecto.Adapters.Postgres.storage_down(TestRepo.config)
#:ok = Ecto.Adapters.Postgres.storage_up(TestRepo.config)

{:ok, _pid} = TestRepo.start_link

#:ok = Ecto.Migrator.up(TestRepo, 0, UsersMigration, log: false)
Ecto.Adapters.SQL.Sandbox.mode(TestRepo, :manual)
#Process.flag(:trap_exit, true)
18 changes: 2 additions & 16 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ExUnit.start()

{:ok, _} = Application.ensure_all_started(:ecto)
{:ok, _} = Application.ensure_all_started(:postgrex)
#{:ok, _} = Application.ensure_all_started(:ecto)
#{:ok, _} = Application.ensure_all_started(:postgrex)
{:ok, _} = NotQwerty123.WordlistManager.start_link

Application.put_env(:openmaize, :remember_salt, "1234567812345678")
Expand All @@ -11,17 +11,3 @@ Code.require_file "support/dummy_crypto.exs", __DIR__
Code.require_file "support/ecto_helper.exs", __DIR__
Code.require_file "support/session_helper.exs", __DIR__
Code.require_file "support/user_helpers.exs", __DIR__

alias Openmaize.TestRepo

defmodule Openmaize.TestCase do
use ExUnit.CaseTemplate

setup do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(TestRepo)
#Ecto.Adapters.SQL.Sandbox.mode(TestRepo, {:shared, self()})
end
end

{:ok, _pid} = TestRepo.start_link
Ecto.Adapters.SQL.Sandbox.mode(TestRepo, {:shared, self()})

0 comments on commit a43a208

Please sign in to comment.