@@ -24,43 +24,44 @@ defmodule Divo.FileTest do
24
24
end
25
25
end
26
26
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" )
31
30
32
- config = Divo.Helper . fetch_config ( )
31
+ config = Divo.Helper . fetch_config ( )
33
32
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
36
35
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 ] )
40
40
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" ] } ]
42
42
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 ( )
45
45
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"
48
47
end
48
+ end
49
49
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 ] )
53
55
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
+ ]
58
60
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 ( )
61
63
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"
64
65
end
65
66
end
66
67
end
0 commit comments