Sha256: 127550a9382eca921627db1bb6d1602a5ea15a5c113728534a3cd4f648a0ccca
Contents?: true
Size: 970 Bytes
Versions: 44
Compression:
Stored size: 970 Bytes
Contents
require "helper" describe Thor::LineEditor::Basic do describe ".available?" do it "returns true" do expect(Thor::LineEditor::Basic).to be_available end end describe "#readline" do it "uses $stdin and $stdout to get input from the user" do expect($stdout).to receive(:print).with("Enter your name ") expect($stdin).to receive(:gets).and_return("George") expect($stdin).not_to receive(:noecho) editor = Thor::LineEditor::Basic.new("Enter your name ", {}) expect(editor.readline).to eq("George") end it "disables echo when asked to" do expect($stdout).to receive(:print).with("Password: ") noecho_stdin = double("noecho_stdin") expect(noecho_stdin).to receive(:gets).and_return("secret") expect($stdin).to receive(:noecho).and_yield(noecho_stdin) editor = Thor::LineEditor::Basic.new("Password: ", :echo => false) expect(editor.readline).to eq("secret") end end end
Version data entries
44 entries across 41 versions & 19 rubygems