diff options
author | Steven Blowers <shdblowers@gmail.com> | 2016-10-30 19:07:36 +0000 |
---|---|---|
committer | Steven Blowers <shdblowers@gmail.com> | 2016-10-30 19:07:36 +0000 |
commit | aefb114037c6670b580c07f0c2ba1cdab4285bcb (patch) | |
tree | a58da4a700be6f68ded8ebb13b1c8b02fdae272e | |
parent | 01d88a22c6cc00b561b0114c0865ba52f355d97c (diff) | |
download | zendex-aefb114037c6670b580c07f0c2ba1cdab4285bcb.tar.gz zendex-aefb114037c6670b580c07f0c2ba1cdab4285bcb.tar.xz |
adding doctests to connection
-rw-r--r-- | lib/zendex/connection.ex | 9 | ||||
-rw-r--r-- | test/zendex/connection_test.exs | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/zendex/connection.ex b/lib/zendex/connection.ex index 248c253..5399f29 100644 --- a/lib/zendex/connection.ex +++ b/lib/zendex/connection.ex @@ -7,6 +7,15 @@ defmodule Zendex.Connection do @typedoc "The connection paramters" @type t :: %{base_url: String.t, authentication: binary} + @doc """ + Setup connection details with your Zendesk. + + ## Examples + + iex> Zendex.Connection.setup("http://example.zendesk.com", "ZendeskUser", "Password1") + %{authentication: "WmVuZGVza1VzZXI6UGFzc3dvcmQx", base_url: "http://example.zendesk.com"} + + """ @spec setup(String.t, String.t, String.t) :: t def setup(base_url, username, password) do authentication = Base.encode64("#{username}:#{password}") diff --git a/test/zendex/connection_test.exs b/test/zendex/connection_test.exs index 6608b44..bf2d238 100644 --- a/test/zendex/connection_test.exs +++ b/test/zendex/connection_test.exs @@ -1,6 +1,8 @@ defmodule Zendex.ConnectionTest do use ExUnit.Case, async: true + doctest Zendex.Connection + test "setup encodes username and password correctly" do expected = %{authentication: "WHhYQXdlc29tZVVzZXJuYW1lWHhYOnBhc3N3b3JkMTIz", base_url: ""} |