Land #18380, Fix broken test suite when running in small console window

This commit is contained in:
Simon Janusz 2023-09-20 11:03:57 +01:00 committed by GitHub
commit 1ef030df76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -164,6 +164,15 @@ RSpec.configure do |config|
Msf::FeatureManager.instance.set(Msf::FeatureManager::DATASTORE_FALLBACKS, true)
end
end
# rex-text table performs word wrapping on msfconsole tables:
# https://github.com/rapid7/rex-text/blob/11e59416f7d8cce18b8b8b9893b3277e6ad0bea1/lib/rex/text/wrapped_table.rb#L74
# This can cause some integration tests to fail if the tests are run from smaller consoles
# This mock will ensure that the tests run without word-wrapping.
config.before(:each) do
mock_io_console = double(:console, winsize: { rows: 30, columns: ::BigDecimal::INFINITY }.values)
allow(::IO).to receive(:console).and_return(mock_io_console)
end
end
if load_metasploit