diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-12-27 03:23:03 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-12-27 03:45:12 -0300 |
commit | 4a8fc9e037e92cf678b42f2fd29bc31e8a6ce356 (patch) | |
tree | 039340b496d60a18946de0e43cf4eaf497754194 | |
parent | 818a3befcc7ba75f60e119f8fc8ea07bb699de2b (diff) | |
download | highline-4a8fc9e037e92cf678b42f2fd29bc31e8a6ce356.tar.gz |
Add #180 test - Menu prompt not reused after failed menu selection
See: https://github.com/JEG2/highline/issues/180
-rw-r--r-- | test/test_menu.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_menu.rb b/test/test_menu.rb index 5edcb03..594f622 100644 --- a/test/test_menu.rb +++ b/test/test_menu.rb @@ -439,4 +439,23 @@ class TestMenu < Minitest::Test assert( @output.string !~ /q to stop.*q to stop/m, "Paging message appeared more than once." ) end + + # Issue #180 - https://github.com/JEG2/highline/issues/180 + def test_menu_prompt + @input << "2\n1\n" + @input.rewind + + selected = @terminal.choose do |menu| + menu.responses[:ask_on_error] = "> " + menu.prompt = "> " + menu.choice :exit, "Exit cube editor" + end + + prompt = "> " + first_asking = "1. exit\n" + error_message = "You must choose one of [1, exit].\n" + complete_interaction = first_asking + prompt + error_message + prompt # Same prompt when repeating question + + assert_equal complete_interaction, @output.string + end end |