Skip to content

Commit

Permalink
fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-goodwin committed May 25, 2023
1 parent 069804b commit b17af6b
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions test/file_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,44 @@ defmodule Divo.FileTest do
end
end

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

Check failure on line 27 in test/file_test.exs

View workflow job for this annotation

GitHub Actions / Verify Application

test generates compose file from app config (Divo.FileTest)
allow(File.write!(any(), any()), return: :ok)
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")

config = Divo.Helper.fetch_config()
config = Divo.Helper.fetch_config()

assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
end
assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
end

test "generates compose file from a behaviour implementation of a single service" do
allow(File.write!(any(), any()), return: :ok)
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
test "generates compose file from a behaviour implementation of a single service" do

Check failure on line 36 in test/file_test.exs

View workflow job for this annotation

GitHub Actions / Verify Application

test generates compose file from a behaviour implementation of a single service (Divo.FileTest)
allow(File.write!(any(), any()), return: :ok)
allow(System.get_env("TMPDIR"), return: "/var/tmp/bar")
allow(DivoFoobar.gen_stack(any()), return: %{}, meck_options: [:non_strict])

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

TemporaryEnv.put :divo, :divo, services do
config = Divo.Helper.fetch_config()
TemporaryEnv.put :divo, :divo, services do
config = Divo.Helper.fetch_config()

assert Divo.File.ensure_file(config) == "/var/tmp/bar/divo.compose"
end
assert Divo.File.ensure_file(config) == "/var/tmp/bar/divo.compose"
end
end

test "concatenates compose file from multiple implementations of the behaviour" do
allow(File.write!(any(), any()), return: :ok)
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
test "concatenates compose file from multiple implementations of the behaviour" do

Check failure on line 50 in test/file_test.exs

View workflow job for this annotation

GitHub Actions / Verify Application

test concatenates compose file from multiple implementations of the behaviour (Divo.FileTest)
allow(File.write!(any(), any()), return: :ok)
allow(System.get_env("TMPDIR"), return: "/var/tmp/foo")
allow(DivoFoobar.gen_stack(any()), return: %{}, meck_options: [:non_strict])
allow(DivoBarbaz.gen_stack(any()), return: %{}, meck_options: [:non_strict])

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

TemporaryEnv.put :divo, :divo, services do
config = Divo.Helper.fetch_config()
TemporaryEnv.put :divo, :divo, services do
config = Divo.Helper.fetch_config()

assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
end
assert Divo.File.ensure_file(config) == "/var/tmp/foo/divo.compose"
end
end
end

0 comments on commit b17af6b

Please sign in to comment.