Skip to content

Commit f15279e

Browse files
committed
fix: force basic line editor in init tests for CI compatibility
Thor prefers Readline when available, which reads from the real terminal fd instead of $stdin. In CI there's no terminal, so Readline returns nil. Stub Readline.available? to false so Thor falls back to Basic editor which reads from $stdin (the StringIO in tests).
1 parent 1c201df commit f15279e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/cli/init_test.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ def run_init(dir, input)
7878
out = nil
7979
Dir.stub(:pwd, dir) do
8080
Fizzy::Auth.stub(:token_data, TOKEN_DATA) do
81-
$stdin = StringIO.new(input)
82-
out, = capture_io { Fizzy::CLI.start(["init"]) }
81+
Thor::LineEditor::Readline.stub(:available?, false) do
82+
$stdin = StringIO.new(input)
83+
out, = capture_io { Fizzy::CLI.start(["init"]) }
84+
end
8385
end
8486
end
8587
out

0 commit comments

Comments
 (0)