update some deisng parameters and add new cases
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "stringio"
|
||||
require_relative "test_helper"
|
||||
|
||||
class PromptingUITest < Minitest::Test
|
||||
def test_menu_prompt_is_a_header_and_answers_are_separated
|
||||
output = StringIO.new
|
||||
ui = FeatherCaseWizard::PromptingUI.wrap(
|
||||
HighLine.new(StringIO.new("1\nDemo\n"), output)
|
||||
)
|
||||
|
||||
selected = ui.choose("Export format (current: 3mf)") do |menu|
|
||||
menu.choice("3MF") { "3mf" }
|
||||
menu.choice("STL") { "stl" }
|
||||
end
|
||||
name = ui.ask("Case name: ")
|
||||
|
||||
assert_equal "3mf", selected
|
||||
assert_equal "Demo", name
|
||||
assert_includes output.string, "Export format (current: 3mf):\n1. 3MF\n2. STL\n? \n"
|
||||
refute_includes output.string, "3. Export format"
|
||||
assert_match(/\? \nCase name: /, output.string)
|
||||
end
|
||||
|
||||
def test_wrap_is_idempotent
|
||||
ui = FeatherCaseWizard::PromptingUI.wrap(HighLine.new)
|
||||
|
||||
assert_same ui, FeatherCaseWizard::PromptingUI.wrap(ui)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user