1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
From: Lucas Nussbaum <lucas@debian.org>
Date: Sat, 16 Jan 2021 09:40:25 +0100
Subject: Disable tests that depend on readline as ruby-rb-readline is not
available in Debian currently
Forwarded: not-needed
spec/line_editor/readline_spec.rb | 69 ---------------------------------------
1 file changed, 69 deletions(-)
delete mode 100644 spec/line_editor/readline_spec.rb
@@ -1,71 +0,0 @@
-require "helper"
-
-describe Thor::LineEditor::Readline do
- before do
- # Eagerly check Readline availability before mocking
- Thor::LineEditor::Readline.available?
- unless defined? ::Readline
- ::Readline = double("Readline")
- allow(::Readline).to receive(:completion_append_character=).with(nil)
- end
- end
-
- describe ".available?" do
- it "returns true when ::Readline exists" do
- allow(Object).to receive(:const_defined?).with(:Readline).and_return(true)
- expect(described_class).to be_available
- end
-
- it "returns false when ::Readline does not exist" do
- allow(Object).to receive(:const_defined?).with(:Readline).and_return(false)
- expect(described_class).not_to be_available
- end
- end
-
- describe "#readline" do
- it "invokes the readline library" do
- expect(::Readline).to receive(:readline).with("> ", true).and_return("foo")
- expect(::Readline).to_not receive(:completion_proc=)
- editor = Thor::LineEditor::Readline.new("> ", {})
- expect(editor.readline).to eq("foo")
- end
-
- it "supports the add_to_history option" do
- expect(::Readline).to receive(:readline).with("> ", false).and_return("foo")
- expect(::Readline).to_not receive(:completion_proc=)
- editor = Thor::LineEditor::Readline.new("> ", :add_to_history => false)
- expect(editor.readline).to eq("foo")
- end
-
- it "provides tab completion when given a limited_to option" do
- expect(::Readline).to receive(:readline)
- expect(::Readline).to receive(:completion_proc=) do |proc|
- expect(proc.call("")).to eq %w(Apples Chicken Chocolate)
- expect(proc.call("Ch")).to eq %w(Chicken Chocolate)
- expect(proc.call("Chi")).to eq ["Chicken"]
- end
-
- editor = Thor::LineEditor::Readline.new("Best food: ", :limited_to => %w(Apples Chicken Chocolate))
- editor.readline
- end
-
- it "provides path tab completion when given the path option" do
- expect(::Readline).to receive(:readline)
- expect(::Readline).to receive(:completion_proc=) do |proc|
- expect(proc.call("../line_ed").sort).to eq ["../line_editor/", "../line_editor_spec.rb"].sort
- end
-
- editor = Thor::LineEditor::Readline.new("Path to file: ", :path => true)
- Dir.chdir(File.dirname(__FILE__)) { editor.readline }
- end
-
- it "uses STDIN when asked not to echo input" 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::Readline.new("Password: ", :echo => false)
- expect(editor.readline).to eq("secret")
- end
- end
-end
|