diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2015-12-27 04:01:00 -0300 |
---|---|---|
committer | Abinoam P. Marques Jr <abinoam@gmail.com> | 2015-12-27 04:01:00 -0300 |
commit | 0b4ea46ac523cab2a5aa58cff51ab2b93747252d (patch) | |
tree | 8117d3b675f432779c7a6ffe6b3a5c66374ef12c | |
parent | 818a3befcc7ba75f60e119f8fc8ea07bb699de2b (diff) | |
parent | b2adbedb64525364a8bc7bc34952c3fec556d254 (diff) | |
download | highline-0b4ea46ac523cab2a5aa58cff51ab2b93747252d.tar.gz |
Merge pull request #181 from abinoam/issue_180v2.0.0.pre.develop.5
Issue #180
-rw-r--r-- | Changelog.md | 3 | ||||
-rw-r--r-- | lib/highline/menu.rb | 8 | ||||
-rw-r--r-- | lib/highline/version.rb | 2 | ||||
-rw-r--r-- | test/test_menu.rb | 19 |
4 files changed, 26 insertions, 6 deletions
diff --git a/Changelog.md b/Changelog.md index 0252073..fb95962 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ Below is a complete listing of changes for each revision of HighLine. +### 2.0.0-develop.5 / 2015-12-27 +* Fix #180 with PR #181 - Make it possible to overwrite the menu prompt shown on errors. + ### 2.0.0-develop.4 / 2015-12-14 This versions makes the code documentation 100% 'A' grade on inch. We have used inch and http://inch-ci.org to guide the priorities diff --git a/lib/highline/menu.rb b/lib/highline/menu.rb index 3e8f5b0..e0c18de 100644 --- a/lib/highline/menu.rb +++ b/lib/highline/menu.rb @@ -425,12 +425,10 @@ class HighLine # This method will update the intelligent responses to account for # Menu specific differences. Calls the superclass' (Question's) # build_responses method, overriding its default arguments to specify - # 'options' will be used to populate choice lists, and that - # the newly built hash will predominate over the preexisting hash - # for any keys that are the same. + # 'options' will be used to populate choice lists. # - def update_responses( ) - build_responses(options, true) + def update_responses + build_responses(options) end end end diff --git a/lib/highline/version.rb b/lib/highline/version.rb index 9c8315c..7977660 100644 --- a/lib/highline/version.rb +++ b/lib/highline/version.rb @@ -2,5 +2,5 @@ class HighLine # The version of the installed library. - VERSION = "2.0.0-develop.4".freeze + VERSION = "2.0.0-develop.5".freeze end 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 |