diff --git a/two-fer/lib/two_fer.ex b/two-fer/lib/two_fer.ex index 24ad791..b461da1 100644 --- a/two-fer/lib/two_fer.ex +++ b/two-fer/lib/two_fer.ex @@ -1,8 +1,11 @@ defmodule TwoFer do + @moduledoc """ + `Two-fer` or `2-fer` is short for two for one. One for you and one for me. + """ + @doc """ Two-fer or 2-fer is short for two for one. One for you and one for me. """ @spec two_fer(String.t()) :: String.t() - def two_fer(name) do - end + def two_fer(name \\ "you") when is_bitstring(name), do: "One for #{name}, one for me." end diff --git a/two-fer/test/two_fer_test.exs b/two-fer/test/two_fer_test.exs index d557738..82b64c3 100644 --- a/two-fer/test/two_fer_test.exs +++ b/two-fer/test/two_fer_test.exs @@ -5,31 +5,26 @@ defmodule TwoFerTest do assert TwoFer.two_fer() == "One for you, one for me." end - @tag :pending test "a name given" do assert TwoFer.two_fer("Alice") == "One for Alice, one for me." end - @tag :pending test "another name given" do assert TwoFer.two_fer("Bob") == "One for Bob, one for me." end - @tag :pending test "when the parameter is a number" do assert_raise FunctionClauseError, fn -> TwoFer.two_fer(10) end end - @tag :pending test "when the parameter is an atom" do assert_raise FunctionClauseError, fn -> TwoFer.two_fer(:bob) end end - @tag :pending test "when the parameter is a charlist" do assert_raise FunctionClauseError, fn -> refute TwoFer.two_fer('Jon Snow')