Skip to content

Commit 18f6a3d

Browse files
Matthew Peckchristophermaier
Matthew Peck
authored andcommitted
chat provider vars should just not be nil
1 parent 3223cb9 commit 18f6a3d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

config/helpers.exs

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ defmodule Cog.Config.Helpers do
5858
defp enabled_provider?({provider, _module}) do
5959
provider_var(provider)
6060
|> System.get_env
61-
|> ensure_boolean
61+
|> is_set?
6262
end
6363

64+
defp is_set?(val), do: not(is_nil(val))
65+
6466
end

test/controllers/v1/chat_handle_controller_test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ defmodule Cog.V1.ChatHandleControllerTest do
6262
end
6363

6464
test "fails if chat adapter for provider is not running", params do
65-
chat_provider = "slack"
65+
chat_provider = "not_a_real_provider"
6666
{:ok, chat} = Cog.Util.Misc.chat_adapter_module
6767
refute chat_provider == chat
6868

6969
conn = api_request(params.authed,
7070
:post, "/v1/users/#{params.authed.id}/chat_handles",
7171
body: %{"chat_handle" => %{handle: "badnews",
72-
chat_provider: "slack"}})
72+
chat_provider: chat_provider}})
7373
assert json_response(conn, 422)["errors"]
7474
end
7575

0 commit comments

Comments
 (0)