From c77aebe5af65147ec2c60019699a22a1d9e57ea3 Mon Sep 17 00:00:00 2001 From: James Mead Date: Fri, 20 Dec 2019 20:29:13 +0000 Subject: [PATCH 1/3] Unpin mocha version The undocumented behaviour that was changed in v1.10.x has been reinstated in v1.11.1 with deprecation warnings. So running the tests against v1.11.1 (the latest version) should not result in any failures. --- sshkit.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sshkit.gemspec b/sshkit.gemspec index f9e6b9cf..7ce539dd 100644 --- a/sshkit.gemspec +++ b/sshkit.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency('rainbow', '~> 2.2.2') gem.add_development_dependency('rake') gem.add_development_dependency('rubocop', "~> 0.49.1") - gem.add_development_dependency('mocha', '~> 1.9.0') + gem.add_development_dependency('mocha') gem.add_development_dependency('bcrypt_pbkdf') gem.add_development_dependency('ed25519', '>= 1.2', '< 2.0') From 09a50baa1acf4a941d30c9190bece6ca00be24bb Mon Sep 17 00:00:00 2001 From: James Mead Date: Fri, 20 Dec 2019 20:32:28 +0000 Subject: [PATCH 2/3] Fix mocha deprecation warning in test helper This change addresses the following deprecation warning: Mocha deprecation warning at test/helper.rb:6:in `require': Require 'mocha/test_unit', 'mocha/minitest' or 'mocha/api' instead of 'mocha/setup'. --- test/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helper.rb b/test/helper.rb index 98e5df7a..f46bdfed 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -3,7 +3,7 @@ require 'tempfile' require 'minitest/autorun' require 'minitest/reporters' -require 'mocha/setup' +require 'mocha/minitest' require 'stringio' require 'json' From 81127641d0315a528c2470d7adf69acd3f19d7e3 Mon Sep 17 00:00:00 2001 From: James Mead Date: Fri, 20 Dec 2019 20:33:50 +0000 Subject: [PATCH 3/3] Fix mocha deprecation warning in TestPretty This addresses the following deprecation warning: Mocha deprecation warning at test/unit/formatters/test_pretty.rb:118:in `test_can_write_to_output_which_just_supports_append': Explicitly include `<<` in Hash of stubbed methods vs return values, e.g. `stub(:<< => nil)`. --- test/unit/formatters/test_pretty.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/formatters/test_pretty.rb b/test/unit/formatters/test_pretty.rb index 7e102139..ae89ea86 100644 --- a/test/unit/formatters/test_pretty.rb +++ b/test/unit/formatters/test_pretty.rb @@ -115,7 +115,7 @@ def test_does_not_log_command_when_verbosity_is_too_low def test_can_write_to_output_which_just_supports_append # Note output doesn't have to be an IO, it only needs to support << - output = stub(:<<) + output = stub(:<< => nil) pretty = SSHKit::Formatter::Pretty.new(output) simulate_command_lifecycle(pretty) end