Add doctests to Hunter.Config

master
Milton Mazzarri 2019-03-19 23:06:26 -05:00
parent 69a885a735
commit 3473d33566
No known key found for this signature in database
GPG Key ID: 9F4193F2B5A558FE
2 changed files with 39 additions and 0 deletions

View File

@ -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

5
test/hunter_test.exs Normal file
View File

@ -0,0 +1,5 @@
defmodule HunterTest do
use ExUnit.Case, async: true
doctest Hunter.Config
end