test/paths/sftp_test.rb in iostreams-1.0.0.beta5 vs test/paths/sftp_test.rb in iostreams-1.0.0.beta6

- old
+ new

@@ -11,10 +11,11 @@ let(:host_name) { ENV["SFTP_HOSTNAME"] } let(:username) { ENV["SFTP_USERNAME"] } let(:password) { ENV["SFTP_PASSWORD"] } let(:ftp_dir) { ENV["SFTP_DIR"] || "iostreams_test" } + let(:identity_username) { ENV["SFTP_IDENTITY_USERNAME"] || username } let(:url) { File.join("sftp://", host_name, ftp_dir) } let(:file_name) { File.join(File.dirname(__FILE__), '..', 'files', 'text.txt') } let(:raw) { File.read(file_name) } @@ -69,11 +70,11 @@ end end describe 'use identity file instead of password' do let :root_path do - IOStreams::Paths::SFTP.new(url, username: username, ssh_options: {'IdentityFile' => ENV["SFTP_IDENTITY_FILE"]} ) + IOStreams::Paths::SFTP.new(url, username: identity_username, ssh_options: {'IdentityFile' => ENV["SFTP_IDENTITY_FILE"]}) end it 'writes' do skip "No identity file env var set: SFTP_IDENTITY_FILE" unless ENV["SFTP_IDENTITY_FILE"] assert_equal raw.size, write_path.writer { |io| io.write(raw) } @@ -82,10 +83,10 @@ end describe 'use identity key instead of password' do let :root_path do key = File.open(ENV["SFTP_IDENTITY_FILE"], 'rb', &:read) - IOStreams::Paths::SFTP.new(url, username: username, ssh_options: {'IdentityKey' => key}) + IOStreams::Paths::SFTP.new(url, username: identity_username, ssh_options: {'IdentityKey' => key}) end it 'writes' do skip "No identity file env var set: SFTP_IDENTITY_FILE" unless ENV["SFTP_IDENTITY_FILE"] assert_equal raw.size, write_path.writer { |io| io.write(raw) }