A unit test exercises a function from a certain module of the application. We might have more than one test exercising the same function (with different inputs, for instance). Let's begin by creating a simple test, which will allow us to analyze ExUnit in detail. We'll be creating the tests for the is_valid_path? function, which belongs to the ElixirDrip.Storage.Media module. For context, we present its implementation as follows:
$ cat apps/elixir_drip/lib/elixir_drip/storage/media.exdefmodule ElixirDrip.Storage.Media do # ... def is_valid_path?(path) when is_binary(path) do valid? = String.starts_with?(path, "$") && !String.ends_with? (path, "/") case valid? do true -> {:ok, :valid} false -> {:error, ...