From 3473d3356637c0c2e4dccf0327bc35ab7b0d21d5 Mon Sep 17 00:00:00 2001 From: Milton Mazzarri Date: Tue, 19 Mar 2019 23:06:26 -0500 Subject: [PATCH] Add doctests to Hunter.Config --- lib/hunter/config.ex | 34 ++++++++++++++++++++++++++++++++++ test/hunter_test.exs | 5 +++++ 2 files changed, 39 insertions(+) create mode 100644 test/hunter_test.exs diff --git a/lib/hunter/config.ex b/lib/hunter/config.ex index 644cb44..751ba7c 100644 --- a/lib/hunter/config.ex +++ b/lib/hunter/config.ex @@ -3,18 +3,52 @@ defmodule Hunter.Config do Hunter configuration. """ + @doc """ + Returns adapter module to do run API calls. + + ## Examples + + iex> Hunter.Config.hunter_api() + Hunter.ApiMock + + """ def hunter_api do Application.get_env(:hunter, :hunter_api, Hunter.Api.HTTPClient) end + @doc """ + Returns the API base URL + + ## Examples + + iex> Hunter.Config.api_base_url() + "https://mastodon.social" + + """ def api_base_url do Application.get_env(:hunter, :api_base_url, "https://mastodon.social") end + @doc """ + Returns the Hunter home directory + + ## Examples + + iex> Path.extname(Hunter.Config.home()) + ".hunter" + + """ def home do Path.expand(System.get_env("HUNTER_HOME") || "~/.hunter") end + @doc """ + Returns HTTP options + + iex> Hunter.Config.http_options() + [] + + """ def http_options do Application.get_env(:hunter, :http_options, []) end diff --git a/test/hunter_test.exs b/test/hunter_test.exs new file mode 100644 index 0000000..7ce47f4 --- /dev/null +++ b/test/hunter_test.exs @@ -0,0 +1,5 @@ +defmodule HunterTest do + use ExUnit.Case, async: true + + doctest Hunter.Config +end