Sha256: 3ca1092275044a7db21353ac579a3acd02dcf641a2265cecc61dd83db7ed2c39
Contents?: true
Size: 914 Bytes
Versions: 6
Compression:
Stored size: 914 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) } subject(:reader) { instance.getc mask } context 'with mask' do let(:mask) { '*'} it 'masks characters' do input << "password\n" input.rewind expect(reader).to eql "password" expect(output.string).to eql("********") end 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 it 'deletes characters when backspace pressed' do input << "\b\b" input.rewind expect(reader).to eql '' expect(output.string).to eql('') end end end
Version data entries
6 entries across 6 versions & 1 rubygems