test/paths/sftp_test.rb in iostreams-1.6.2 vs test/paths/sftp_test.rb in iostreams-1.7.0

- old
+ new

@@ -18,10 +18,16 @@ let(:url) { File.join("sftp://", host_name, ftp_dir) } let(:file_name) { File.join(File.dirname(__FILE__), "..", "files", "text file.txt") } let(:raw) { File.read(file_name) } - let(:root_path) { IOStreams::Paths::SFTP.new(url, username: username, password: password) } + let(:root_path) do + if ENV["SFTP_HOST_KEY"] + IOStreams::Paths::SFTP.new(url, username: username, password: password, ssh_options: {"HostKey" => ENV["SFTP_HOST_KEY"]}) + else + IOStreams::Paths::SFTP.new(url, username: username, password: password) + end + end let :existing_path do path = root_path.join("test.txt") path.write(raw) path