Skip to content

Commit

Permalink
Fix tests that need a tty but don't have one on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Apr 1, 2022
1 parent f1efd0e commit e75c349
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
SimpleCov.start
end

# In GitHub Actions (CI), we do not have a tty, so the various tests that use
# STDIN in order to test interactivity will fail. This code creates a psuedo-tty
# in that environment. If you want to test locally in a "non-tty" way, you can
# run the tests as follows: `true | bundle exec rake 2>&1 | cat`
unless STDIN.tty?
require "pty"
require "io/console"
_master_io, slave_file = PTY.open
slave_file.raw!
STDIN.reopen(slave_file)
end

require "manageiq-appliance_console"
ManageIQ::ApplianceConsole.logger = Logger.new("/dev/null")

Expand Down

0 comments on commit e75c349

Please sign in to comment.