summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAna María Martínez Gómez <anamaria@martinezgomez.name>2019-04-07 08:20:00 +0200
committerAna María Martínez Gómez <anamaria@martinezgomez.name>2019-04-08 16:28:52 +0200
commitc553fbe9db01a1b969aa06bd609149daac736fb3 (patch)
treed43b416e2aa7b32e0aeaaa993a323c1e5e3b323b /test
parent1c9a9a3a9f19b9a97d3650f206acb0e9800611b7 (diff)
downloadhighline-c553fbe9db01a1b969aa06bd609149daac736fb3.tar.gz
Add tests and documentation for capital_letter
We didn't have time for this during the The Biggest Mobprogramming session ever at RubyConfBY 2019: https://rubyconference.by @dmitriy-kiriyenko implemented it in https://github.com/JEG2/highline/pull/242, so I cherry-picked it from there. Co-authored-by: Dmitriy Kiriyenko <dmitriy.kiriyenko@gmail.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_menu.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_menu.rb b/test/test_menu.rb
index 6278c7c..2a8cbaf 100755
--- a/test/test_menu.rb
+++ b/test/test_menu.rb
@@ -539,6 +539,19 @@ class TestMenu < Minitest::Test
assert_equal(:load, selected)
end
+ def test_select_by_capital_letter
+ @input << "B\n"
+ @input.rewind
+
+ selected = @terminal.choose do |menu|
+ menu.index = :capital_letter
+ menu.choice :save
+ menu.choice :load
+ menu.choice :quit
+ end
+ assert_equal(:load, selected)
+ end
+
def test_shell
@input << "save --some-option my_file.txt\n"
@input.rewind