Answer new prompt interactively

This commit is contained in:
Mark Felder 2020-12-04 12:07:23 -06:00
parent 50aadc3d5c
commit 657002e738

View file

@ -36,7 +36,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do
unsaved = build(:user) unsaved = build(:user)
# prepare to answer yes # prepare to answer yes
send(self(), {:mix_shell_input, :yes?, true}) send(self(), {:mix_shell_input, :prompt, "Y"})
Mix.Tasks.Pleroma.User.run([ Mix.Tasks.Pleroma.User.run([
"new", "new",
@ -55,7 +55,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message =~ "user will be created" assert message =~ "user will be created"
assert_received {:mix_shell, :yes?, [message]} assert_received {:mix_shell, :prompt, [message]}
assert message =~ "Continue" assert message =~ "Continue"
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
@ -73,14 +73,14 @@ defmodule Mix.Tasks.Pleroma.UserTest do
unsaved = build(:user) unsaved = build(:user)
# prepare to answer no # prepare to answer no
send(self(), {:mix_shell_input, :yes?, false}) send(self(), {:mix_shell_input, :prompt, "N"})
Mix.Tasks.Pleroma.User.run(["new", unsaved.nickname, unsaved.email]) Mix.Tasks.Pleroma.User.run(["new", unsaved.nickname, unsaved.email])
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}
assert message =~ "user will be created" assert message =~ "user will be created"
assert_received {:mix_shell, :yes?, [message]} assert_received {:mix_shell, :prompt, [message]}
assert message =~ "Continue" assert message =~ "Continue"
assert_received {:mix_shell, :info, [message]} assert_received {:mix_shell, :info, [message]}