Skip to content

Commit

Permalink
chat provider vars should just not be nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Peck authored and christophermaier committed Oct 11, 2016
1 parent 3223cb9 commit 18f6a3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion config/helpers.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ defmodule Cog.Config.Helpers do
defp enabled_provider?({provider, _module}) do
provider_var(provider)
|> System.get_env
|> ensure_boolean
|> is_set?
end

defp is_set?(val), do: not(is_nil(val))

end
4 changes: 2 additions & 2 deletions test/controllers/v1/chat_handle_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ defmodule Cog.V1.ChatHandleControllerTest do
end

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

conn = api_request(params.authed,
:post, "/v1/users/#{params.authed.id}/chat_handles",
body: %{"chat_handle" => %{handle: "badnews",
chat_provider: "slack"}})
chat_provider: chat_provider}})
assert json_response(conn, 422)["errors"]
end

Expand Down

0 comments on commit 18f6a3d

Please sign in to comment.