Created
March 2, 2016 01:19
-
-
Save johnhamelink/fbe4f5490b7b1dea9c07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule ExrmDebTest.ConfigTest do | |
| use ExUnit.Case, async: false | |
| import ExUnit.CaptureIO | |
| test "Configuration is sanitized correctly" do | |
| out = ExrmDeb.Utils.Config.sanitize_config(%{ name: "$!JIM-B+O.B,'" }) | |
| assert Map.fetch!(out, :sanitized_name) | |
| assert Map.fetch!(out, :sanitized_name) == "jim-b+o.b" | |
| end | |
| test "building default config works correctly" do | |
| assert {:ok, _} = ExrmDeb.Config.build_config | |
| end | |
| test "building an invalid config results in an error being raised" do | |
| capture_io(fn -> | |
| assert {:error, [{:error, :description, :presence, "must be present"}]} = | |
| ExrmDeb.Config.build_config(%{description: nil}) | |
| end) | |
| end | |
| test "owner must have both user and group" do | |
| capture_io(fn -> | |
| assert {:error, [{:error, [:owner, :group], :presence, "must be present"}]} = | |
| ExrmDeb.Config.build_config(%{owner: [user: "root"]}) | |
| end) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment