Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config file locations and clean up test warnings #217

Merged
merged 1 commit into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import_config "#{Mix.env}.exs"
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions config/deploy/test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use Mix.Config
8 changes: 0 additions & 8 deletions config/test.exs

This file was deleted.

2 changes: 1 addition & 1 deletion lib/bootleg/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ defmodule Bootleg.Config do
```
use Bootleg.Config
config :foo, :bar

# local_foo will be :bar
local_foo = config :foo

Expand Down
5 changes: 4 additions & 1 deletion test/bootleg/config/agent_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule Bootleg.Config.AgentTest do
use Bootleg.TestCase, async: false
alias Bootleg.Config.Agent
import ExUnit.CaptureIO

test "stores values for retrieval" do
{:ok, _} = Agent.start_link
Expand Down Expand Up @@ -29,7 +30,9 @@ defmodule Bootleg.Config.AgentTest do
end

test "start_link/1 sets the environment to the provided env" do
Agent.start_link(:bar)
capture_io(fn ->
Agent.start_link(:bar)
end)
assert Agent.get(:config) == [env: :bar]
end
end
9 changes: 6 additions & 3 deletions test/bootleg/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ defmodule Bootleg.ConfigTest do
alias Bootleg.{Config, UI, SSH}
alias Config.Agent
alias Mix.Project
import ExUnit.CaptureIO
import Mock

doctest Bootleg.Config
Expand Down Expand Up @@ -216,13 +217,15 @@ defmodule Bootleg.ConfigTest do
end

test "env/1" do
Config.env(:bar)
capture_io(fn ->
Config.env(:bar)
end)
assert :bar == Config.env
end

test_with_mock "env/1 starts the agent", Agent, [:passthrough], [] do
Config.env(:bar)
assert called Agent.start_link(:bar)
Config.env(:test)
assert called Agent.start_link(:test)
end

test "invoke/1" do
Expand Down