1 defmodule Mix.PleromaTest do
2 use ExUnit.Case, async: true
6 Mix.shell(Mix.Shell.Process)
9 Mix.shell(Mix.Shell.IO)
15 describe "shell_prompt/1" do
17 send(self(), {:mix_shell_input, :prompt, "Yes"})
19 answer = shell_prompt("Do you want this?")
20 assert_received {:mix_shell, :prompt, [message]}
21 assert message =~ "Do you want this?"
22 assert answer == "Yes"
26 send(self(), {:mix_shell_input, :prompt, "\n"})
28 answer = shell_prompt("Do you want this?", "defval")
30 assert_received {:mix_shell, :prompt, [message]}
31 assert message =~ "Do you want this? [defval]"
32 assert answer == "defval"
36 describe "get_option/3" do
37 test "get from options" do
38 assert get_option([domain: "some-domain.com"], :domain, "Promt") == "some-domain.com"
41 test "get from prompt" do
42 send(self(), {:mix_shell_input, :prompt, "another-domain.com"})
43 assert get_option([], :domain, "Prompt") == "another-domain.com"