diff options
author | Scott Paeth <scott.paeth@freshgrade.com> | 2017-07-21 11:06:48 -0700 |
---|---|---|
committer | Scott Paeth <scott.paeth@freshgrade.com> | 2017-07-21 11:12:34 -0700 |
commit | aea2d6b7aed6344318ab14872736ce74712d4f93 (patch) | |
tree | a83e010d2343e14b9ea3389ed6807d1878ebda45 /test/test_config.rb | |
parent | c1777563f04fd04be16a2ab22ac0af541a5b1f87 (diff) | |
download | net-ssh-aea2d6b7aed6344318ab14872736ce74712d4f93.tar.gz |
Added unit tests
Specifically: references to default_files and default_auth_methods
shouldn't modify the class variables, so we're asserting whether the
before and after states are equal.
Diffstat (limited to 'test/test_config.rb')
-rw-r--r-- | test/test_config.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_config.rb b/test/test_config.rb index 6c34f7a..21af929 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -286,6 +286,25 @@ class TestConfig < NetSSHTest assert_equal %w(~/.ssh/id.pem ~/.ssh/id2.pem ~/.ssh/id3.pem), net_ssh[:keys] end + + def test_default_files_not_mutable + original_default_files = Net::SSH::Config.default_files.clone + + default_files = Net::SSH::Config.default_files + default_files.push('garbage') + + assert_equal(original_default_files, Net::SSH::Config.default_files) + end + + def test_default_auth_methods_not_mutable + original_default_auth_methods = Net::SSH::Config.default_auth_methods.clone + + default_auth_methods = Net::SSH::Config.default_auth_methods + default_auth_methods.push('garbage') + + assert_equal(original_default_auth_methods, Net::SSH::Config.default_auth_methods) + end + private def with_home_env(value,&block) |