Sha256: 0321c67590c13206523c024bcb15a9c5a96d5b6f709c50145c3e07372df2225c
Contents?: true
Size: 571 Bytes
Versions: 3
Compression:
Stored size: 571 Bytes
Contents
RSpec.describe TTY::Prompt, '#subscribe' do it "subscribes to key events only for the current prompt" do prompt = TTY::TestPrompt.new uuid = '14c3b412-e0c5-4ff5-9cd8-25ec3f18c702' prompt.input << "3\n#{uuid}\n" prompt.input.rewind keys = [] prompt.on(:keypress) do |event| keys << :enter if event.key.name == :enter end letter = prompt.enum_select('Select something', ('A'..'Z').to_a) id = prompt.ask('Request ID?') expect(letter).to eq('C') expect(id).to eq(uuid) expect(keys).to eq([:enter, :enter]) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tty-prompt-0.17.2 | spec/unit/subscribe_spec.rb |
tty-prompt-0.17.1 | spec/unit/subscribe_spec.rb |
tty-prompt-0.17.0 | spec/unit/subscribe_spec.rb |