-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass around settings as module instead of Map
- Loading branch information
Showing
4 changed files
with
62 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defmodule BoomNotifier.BoomNotifierTest do | ||
use BoomNotifier.Case | ||
|
||
defmodule FakeNotifier do | ||
def notify(_, _), do: nil | ||
end | ||
|
||
describe "to_config/1" do | ||
defmodule ToConfigEndpoint do | ||
def call(conn, _opts), do: conn | ||
|
||
use BoomNotifier, | ||
notifier: FakeNotifier | ||
end | ||
|
||
test "accepts a module name" do | ||
assert BoomNotifier.to_config(ToConfigEndpoint) == ToConfigEndpoint.boom_config() | ||
end | ||
|
||
test "it calls boom_notifier when a module is specified" do | ||
assert_raise(UndefinedFunctionError, fn -> | ||
BoomNotifier.to_config(Kernel) | ||
end) | ||
end | ||
|
||
test "accepts a keyword list" do | ||
assert BoomNotifier.to_config(notifier: FakeNotifier) == ToConfigEndpoint.boom_config() | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters