diff options
author | Ivan Tashkinov <ivant.business@gmail.com> | 2019-07-09 21:46:16 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivant.business@gmail.com> | 2019-07-09 21:46:16 +0300 |
commit | 829e99722396c2372770f50d9fc7cfa40c441005 (patch) | |
tree | 6b72aa4ac5e049eb8bf444ade64e8da4499ef023 /test/tasks/pleroma_test.exs | |
parent | 46cf81a544edd91f4c3893897fbe2db053f5f6d5 (diff) | |
parent | 2bb945cb70751bc8e72c036040130bb54c32f391 (diff) | |
download | pleroma-829e99722396c2372770f50d9fc7cfa40c441005.tar.gz pleroma-829e99722396c2372770f50d9fc7cfa40c441005.zip |
[#878] Merge remote-tracking branch 'remotes/upstream/develop' into 878-activity-object-decoupling-in-tests
# Conflicts:
# lib/pleroma/object.ex
# test/web/activity_pub/transmogrifier_test.exs
# test/web/ostatus/ostatus_test.exs
Diffstat (limited to 'test/tasks/pleroma_test.exs')
-rw-r--r-- | test/tasks/pleroma_test.exs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/tasks/pleroma_test.exs b/test/tasks/pleroma_test.exs new file mode 100644 index 000000000..e236ccbbb --- /dev/null +++ b/test/tasks/pleroma_test.exs @@ -0,0 +1,46 @@ +defmodule Mix.PleromaTest do + use ExUnit.Case, async: true + import Mix.Pleroma + + setup_all do + Mix.shell(Mix.Shell.Process) + + on_exit(fn -> + Mix.shell(Mix.Shell.IO) + end) + + :ok + end + + describe "shell_prompt/1" do + test "input" do + send(self(), {:mix_shell_input, :prompt, "Yes"}) + + answer = shell_prompt("Do you want this?") + assert_received {:mix_shell, :prompt, [message]} + assert message =~ "Do you want this?" + assert answer == "Yes" + end + + test "with defval" do + send(self(), {:mix_shell_input, :prompt, "\n"}) + + answer = shell_prompt("Do you want this?", "defval") + + assert_received {:mix_shell, :prompt, [message]} + assert message =~ "Do you want this? [defval]" + assert answer == "defval" + end + end + + describe "get_option/3" do + test "get from options" do + assert get_option([domain: "some-domain.com"], :domain, "Promt") == "some-domain.com" + end + + test "get from prompt" do + send(self(), {:mix_shell_input, :prompt, "another-domain.com"}) + assert get_option([], :domain, "Prompt") == "another-domain.com" + end + end +end |