Skip to content

Commit

Permalink
Merge pull request #752 from inspec/ss/fix-mocha-incompatibility
Browse files Browse the repository at this point in the history
Fix `mocha` ~1.1 incompatibility with `minitest`
  • Loading branch information
Vasu1105 authored Oct 16, 2023
2 parents 6884a74 + 6c19a55 commit 7392981
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions .expeditor/buildkite/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bundle --version

echo "--- bundle install"
bundle config --local path vendor/bundle
bundle config --local without integration tools
bundle install --jobs=7 --retry=3

echo "+++ bundle exec rake"
Expand Down
9 changes: 3 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
source "https://rubygems.org"
gemspec name: "train"

if Gem.ruby_version.to_s.start_with?("2.5")
# 16.7.23 required ruby 2.6+
gem "chef-utils", "< 16.7.23" # TODO: remove when we drop ruby 2.5
end

group :test do
gem "minitest", "~> 5.8"
gem "rake", "~> 13.0"
Expand All @@ -20,7 +15,9 @@ group :test do
# but it's close enough to show the gempath handler can find a plugin
# See test/unit/
gem "train-test-fixture", path: "test/fixtures/plugins/train-test-fixture"
gem "mocha", "~> 1.1"
# Mocha ~1.1 is incompatible with minitest v5.19 and later
# More on the issue: https://github.com/freerange/mocha/issues/614
gem "mocha", "~> 2"
end

if Gem.ruby_version >= Gem::Version.new("2.7.0")
Expand Down
5 changes: 3 additions & 2 deletions test/unit/transports/ssh_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@
end

it "sets up a proxy when ssh proxy command is specified" do
mock = MiniTest::Mock.new
mock = Minitest::Mock.new

mock.expect(:call, true) do |hostname, username, options|
options[:proxy].is_a?(Net::SSH::Proxy::Command) &&
"ssh [email protected] -W %h:%p" == options[:proxy].command_line_template
Expand Down Expand Up @@ -384,7 +385,7 @@
end

it "sets up a proxy when ssh proxy command is specified" do
mock = MiniTest::Mock.new
mock = Minitest::Mock.new
mock.expect(:call, true) do |hostname, username, options|
options[:proxy].is_a?(Net::SSH::Proxy::Command) &&
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR -o ForwardAgent=no -o IdentitiesOnly=yes -i #{conf[:key_files]} root@bastion_dummy -p 22 -W %h:%p" == options[:proxy].command_line_template
Expand Down

0 comments on commit 7392981

Please sign in to comment.