diff options
author | Delano Mandelbaum <delano.mandelbaum@gmail.com> | 2013-04-18 10:36:15 -0700 |
---|---|---|
committer | Delano Mandelbaum <delano.mandelbaum@gmail.com> | 2013-04-18 10:36:15 -0700 |
commit | b262fab55002e45781db99499700b41e2d734083 (patch) | |
tree | a695255ae69cd6f7cdeeacdcc43b7c6de88c5858 | |
parent | 9f4f888415b0dffb906d99a71b084b4fcfb61ce0 (diff) | |
parent | 3149427abc3036806e5169bdc2b5a9ca57ba3664 (diff) | |
download | net-ssh-b262fab55002e45781db99499700b41e2d734083.tar.gz |
Merge pull request #98 from grobie/master
Make sure HOME is an absolute path
-rw-r--r-- | README.rdoc | 2 | ||||
-rw-r--r-- | lib/net/ssh.rb | 2 | ||||
-rw-r--r-- | test/test_config.rb | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/README.rdoc b/README.rdoc index fe4599f..35646c2 100644 --- a/README.rdoc +++ b/README.rdoc @@ -153,7 +153,7 @@ which should produce the following: Run the test suite from the net-ssh directory with the following command: - ruby -Ilib -Itest -rrubygems test/test_all.rb + bash -c 'unset HOME && ruby -Ilib -Itest -rrubygems test/test_all.rb' Run a single test file like this: diff --git a/lib/net/ssh.rb b/lib/net/ssh.rb index 2fbe078..809e565 100644 --- a/lib/net/ssh.rb +++ b/lib/net/ssh.rb @@ -1,6 +1,6 @@ # Make sure HOME is set, regardless of OS, so that File.expand_path works # as expected with tilde characters. -ENV['HOME'] ||= ENV['HOMEPATH'] ? "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" : "." +ENV['HOME'] ||= ENV['HOMEPATH'] ? "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" : Dir.pwd require 'logger' diff --git a/test/test_config.rb b/test/test_config.rb index 548072f..634252a 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -1,7 +1,12 @@ require 'common' require 'net/ssh/config' +require 'pathname' class TestConfig < Test::Unit::TestCase + def test_home_should_be_absolute_path + assert Pathname.new(ENV['HOME']).absolute? + end + def test_load_for_non_existant_file_should_return_empty_hash bogus_file = File.expand_path("/bogus/file") File.expects(:readable?).with(bogus_file).returns(false) |