Skip to content

Commit b17af6b

Browse files
fixed some tests
1 parent 069804b commit b17af6b

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

test/file_test.exs

+27-26
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,44 @@ defmodule Divo.FileTest do
2424
end
2525
end
2626

27-
describe "generate" do
28-
test "generates compose file from app config" do
29-
allow(File.write!(any(), any()), return: :ok)
30-
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
27+
test "generates compose file from app config" do
28+
allow(File.write!(any(), any()), return: :ok)
29+
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
3130

32-
config = Divo.Helper.fetch_config()
31+
config = Divo.Helper.fetch_config()
3332

34-
assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
35-
end
33+
assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
34+
end
3635

37-
test "generates compose file from a behaviour implementation of a single service" do
38-
allow(File.write!(any(), any()), return: :ok)
39-
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
36+
test "generates compose file from a behaviour implementation of a single service" do
37+
allow(File.write!(any(), any()), return: :ok)
38+
allow(System.get_env("TMPDIR"), return: "/var/tmp/bar")
39+
allow(DivoFoobar.gen_stack(any()), return: %{}, meck_options: [:non_strict])
4040

41-
services = [{DivoFoobar, [db_password: "we-are-divo", db_name: "foobar-db", something: "else"]}]
41+
services = [{DivoFoobar, [db_password: "we-are-divo", db_name: "foobar-db", something: "else"]}]
4242

43-
TemporaryEnv.put :divo, :divo, services do
44-
config = Divo.Helper.fetch_config()
43+
TemporaryEnv.put :divo, :divo, services do
44+
config = Divo.Helper.fetch_config()
4545

46-
assert Divo.File.ensure_file(config) == "/var/tmp/bar/divo.compose"
47-
end
46+
assert Divo.File.ensure_file(config) == "/var/tmp/bar/divo.compose"
4847
end
48+
end
4949

50-
test "concatenates compose file from multiple implementations of the behaviour" do
51-
allow(File.write!(any(), any()), return: :ok)
52-
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
50+
test "concatenates compose file from multiple implementations of the behaviour" do
51+
allow(File.write!(any(), any()), return: :ok)
52+
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
53+
allow(DivoFoobar.gen_stack(any()), return: %{}, meck_options: [:non_strict])
54+
allow(DivoBarbaz.gen_stack(any()), return: %{}, meck_options: [:non_strict])
5355

54-
services = [
55-
{DivoFoobar, [db_password: "we-are-divo", db_name: "foobar-db", something: "else"]},
56-
DivoBarbaz
57-
]
56+
services = [
57+
{DivoFoobar, [db_password: "we-are-divo", db_name: "foobar-db", something: "else"]},
58+
DivoBarbaz
59+
]
5860

59-
TemporaryEnv.put :divo, :divo, services do
60-
config = Divo.Helper.fetch_config()
61+
TemporaryEnv.put :divo, :divo, services do
62+
config = Divo.Helper.fetch_config()
6163

62-
assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
63-
end
64+
assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
6465
end
6566
end
6667
end

0 commit comments

Comments
 (0)