Sha256: 76666664c8073013486c5ed0edc5ee5d86e082d92c72e1b4961e71ab701c5b3e
Contents?: true
Size: 850 Bytes
Versions: 3
Compression:
Stored size: 850 Bytes
Contents
# encoding: utf-8 RSpec.describe TTY::Prompt::Reader, '#read_line' do let(:input) { StringIO.new } let(:output) { StringIO.new } subject(:reader) { described_class.new(input, output) } it 'masks characters' do mask = '*' input << "password" input.rewind answer = reader.read_line(mask) expect(answer).to eq("password") end it "echoes characters back" do input << "password" input.rewind answer = reader.read_line expect(answer).to eq("password") expect(output.string).to eq("") end it 'deletes characters when backspace pressed' do input << "aa\ba\bcc" input.rewind answer = reader.read_line expect(answer).to eq('acc') end it 'reads multibyte line' do input << "한글" input.rewind answer = reader.read_line expect(answer).to eq("한글") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tty-prompt-0.10.1 | spec/unit/reader/read_line_spec.rb |
tty-prompt-0.10.0 | spec/unit/reader/read_line_spec.rb |
tty-prompt-0.9.0 | spec/unit/reader/read_line_spec.rb |