Sha256: 6bbae369d9ba9a4e2eba82db1592dcaa8cb68435c485bdfcd3b079a9c98427a8
Contents?: true
Size: 865 Bytes
Versions: 5
Compression:
Stored size: 865 Bytes
Contents
# -*- encoding: utf-8 -*- require 'spec_helper' describe TTY::Shell::Reader, '#getc' do let(:instance) { described_class.new(shell) } let(:input) { StringIO.new } let(:output) { StringIO.new } let(:shell) { TTY::Shell.new(input, output) } let(:mask) { '*'} subject(:reader) { instance.getc mask } it 'masks characters' do input << "password\n" input.rewind expect(reader).to eql "password" expect(output.string).to eql("********") end context "without mask" do let(:mask) { } it 'masks characters' do input << "password\n" input.rewind expect(reader).to eql "password" expect(output.string).to eql("password") end end it 'deletes characters when backspace pressed' do input << "\b\b" input.rewind expect(reader).to eql '' expect(output.string).to eql('') end end
Version data entries
5 entries across 5 versions & 1 rubygems