test/common.rb in net-ssh-3.1.1 vs test/common.rb in net-ssh-3.2.0.rc1
- old
+ new
@@ -13,10 +13,22 @@
# clear the default files out so that tests don't get confused by existing
# SSH config files.
$original_config_default_files = Net::SSH::Config.default_files.dup
Net::SSH::Config.default_files.clear
+def with_restored_default_files(&block)
+ act_default_files = Net::SSH::Config.default_files.dup
+ begin
+ Net::SSH::Config.default_files.clear
+ Net::SSH::Config.default_files.concat($_original_config_default_files) # rubocop:disable Style/GlobalVars
+ yield
+ ensure
+ Net::SSH::Config.default_files.clear
+ Net::SSH::Config.default_files.concat(act_default_files)
+ end
+end
+
def P(*args)
Net::SSH::Packet.new(Net::SSH::Buffer.from(*args))
end
class MockTransport < Net::SSH::Transport::Session
@@ -67,9 +79,13 @@
if mock_enqueue
send_message(message)
else
super
end
+ end
+
+ def closed?
+ false
end
def poll_message
@queue.shift
end