Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Commit

Permalink
Fix tests which relied on conform
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwalker committed Oct 8, 2015
1 parent 226633e commit 5914e52
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
22 changes: 13 additions & 9 deletions test/fixtures/example_app/config/test.schema.exs
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,25 @@
default: 10
]
],
translations: [
"test.debug.level": fn _mapping, val ->
case(val) do
:active ->
transforms: [
"test.debug_level": fn conf ->
case Conform.Conf.get(conf, "test.debug_level") do
[{_, :active}] ->
{:on, []}
:"active-debug" ->
[{_, :"active-debug"}] ->
{:on, [:debug]}
:passive ->
[{_, :passive}] ->
{:on, [:passive]}
:off ->
[{_, :off}] ->
{:off, []}
[] ->
end
end,
"test.some_val": fn _mapping, val ->
FakeProject.inc_some_val(val)
"test.some_val": fn conf ->
case Conform.Conf.get(conf, "test.some_val") do
[{_, x}] when is_integer(x) -> FakeProject.inc_some_val(x)
[{_, x}] -> x
end
end
]
]
2 changes: 1 addition & 1 deletion test/fixtures/example_app/lib/test/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Test.Server do
use GenServer

def start_link() do
:gen_server.start_link({:local, :test}, __MODULE__, [], [])
GenServer.start_link(__MODULE__, [], [name: __MODULE__])
end

def init([]) do
Expand Down
10 changes: 3 additions & 7 deletions test/fixtures/example_app/lib/test/supervisor.ex
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
defmodule Test.Supervisor do
use Supervisor

def start_link do
:supervisor.start_link(__MODULE__, [])
end
import Supervisor.Spec, warn: false

def init([]) do
children = [
# Define workers and child supervisors to be supervised
worker(Test.Server, [])
]

# See http://elixir-lang.org/docs/stable/Supervisor.Behaviour.html
# for other strategies and supported options
supervise(children, strategy: :one_for_one)
Supervisor.start_link(children, [strategy: :one_for_one, name: Test.Supervisor])
end

end
2 changes: 1 addition & 1 deletion test/fixtures/example_app/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Test.Mixfile do
# { :barbat, "~> 0.1", github: "elixir-lang/barbat" }
defp deps do
[{:exrm, path: "../../../"},
{:conform, path: "../../../deps/conform", override: true},
{:conform, "~> 1.0.0-pre", override: true},
{:fake_project, path: "../fake_project"}]
end
end
2 changes: 0 additions & 2 deletions test/plugin_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ defmodule PluginTest do
active = [
ReleaseManager.Plugin.Appups,
ReleaseManager.Plugin.Consolidation,
ReleaseManager.Plugin.Conform
] |> Enum.sort

assert :ok = Utils.mix("do deps.get, compile", Mix.env, :quiet)
assert active == ReleaseManager.Plugin.load_all |> Enum.sort
end
end

0 comments on commit 5914e52

Please sign in to comment.