Skip to content

Commit

Permalink
(maint) Update Minitest capitalization
Browse files Browse the repository at this point in the history
Minitest v5.19.0, released today, includes a commit[1] that only calls
its compatibility layer when using an environment variable
("MT_COMPAT").

This means that calling "MiniTest" (with a capital "T") instead of
"Minitest" (with all lowercase "T"s) no longer works.

This commit replaces all instances of "MiniTest" with "Minitest."

[1] minitest/minitest@a2c6c18
  • Loading branch information
mhashizume committed Jul 26, 2023
1 parent 6e73071 commit bcbb68e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions acceptance/lib/helpers/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create_local_file_from_fixture(fixture, local_path, filename, perms = nil)
# assert_equal expected, user
# end
#
# Absorbs any MiniTest::Assertion from a failing test assertion in the block.
# Absorbs any Minitest::Assertion from a failing test assertion in the block.
# This implies that the intermittent failure is caught and the suite will not
# go red for this failure. Intended to be used with the Jenkins Build Failure
# Analyzer (or similar), to detect these failures without failing the build.
Expand All @@ -69,7 +69,7 @@ def fails_intermittently(issue_link, args = {})
raise ArgumentError, "provide a Jira ticket link" unless issue_link
raise ArgumentError, "a block is required" unless block_given?
yield
rescue MiniTest::Assertion, StandardError, SignalException # we have a test failure!
rescue Minitest::Assertion, StandardError, SignalException # we have a test failure!
STDERR.puts "\n\nIntermittent test failure! See: #{issue_link}"

if args.empty?
Expand Down
2 changes: 1 addition & 1 deletion lib/beaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ module Beaker
# Shared methods and helpers
require 'beaker/shared'

# MiniTest, for including MiniTest::Assertions
# Minitest, for including MiniTest::Assertions
require 'minitest/test'
end
2 changes: 1 addition & 1 deletion lib/beaker/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestCase
include Beaker::DSL

# The Exception raised by Ruby's STDLIB's test framework (Ruby 1.9)
TEST_EXCEPTION_CLASS = ::MiniTest::Assertion
TEST_EXCEPTION_CLASS = ::Minitest::Assertion

# Necessary for implementing {Beaker::DSL::Helpers#confine}.
# Assumed to be an array of valid {Beaker::Host} objects for
Expand Down
2 changes: 1 addition & 1 deletion spec/beaker/dsl/assertions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ClassMixedWithDSLAssertions
expect( result ).to receive( :output ).and_return( output )

expect( subject ).to receive( :result ).at_least( :once ).and_return( result )
expect { subject.assert_output expectation }.to raise_error( MiniTest::Assertion )
expect { subject.assert_output expectation }.to raise_error( Minitest::Assertion )
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/beaker/dsl/structure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class ClassMixedWithDSLStructure
end

describe '#expect_failure' do
it 'passes when a MiniTest assertion is raised' do
it 'passes when a Minitest assertion is raised' do
expect( subject ).to receive( :logger ).and_return( logger )
expect( logger ).to receive( :notify )
# We changed this lambda to use the simplest assert possible; using assert_equal
Expand All @@ -213,9 +213,9 @@ class ClassMixedWithDSLStructure
expect{ subject.expect_failure 'this is an expected failure', &block }.not_to raise_error
end

it 'fails when a non-Beaker, non-MiniTest assertion is raised' do
block = lambda { raise 'not a Beaker or MiniTest error' }
expect{ subject.expect_failure 'this has a non-Beaker, non-MiniTest exception', &block }.to raise_error(RuntimeError, /not a Beaker or MiniTest error/)
it 'fails when a non-Beaker, non-Minitest assertion is raised' do
block = lambda { raise 'not a Beaker or Minitest error' }
expect{ subject.expect_failure 'this has a non-Beaker, non-Minitest exception', &block }.to raise_error(RuntimeError, /not a Beaker or MiniTest error/)
end

it 'fails when no assertion is raised' do
Expand Down
2 changes: 1 addition & 1 deletion spec/beaker/host/mac/group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MacGroupTest
result.stdout = ''
group_name = 'any_name'
expect( subject ).to receive( :execute ).and_yield(result)
expect { subject.group_get(group_name) }.to raise_error(MiniTest::Assertion, "failed to get group #{group_name}")
expect { subject.group_get(group_name) }.to raise_error(Minitest::Assertion, "failed to get group #{group_name}")
end

it 'parses mac dscacheutil output into /etc/group format correctly' do
Expand Down
2 changes: 1 addition & 1 deletion spec/beaker/host/mac/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class MacUserTest
result.stdout = ''
user_name = 'any_name'
expect( subject ).to receive( :execute ).and_yield(result)
expect { subject.user_get(user_name) }.to raise_error(MiniTest::Assertion, "failed to get user #{user_name}")
expect { subject.user_get(user_name) }.to raise_error(Minitest::Assertion, "failed to get user #{user_name}")
end

it 'yields correctly with the result object' do
Expand Down

0 comments on commit bcbb68e

Please sign in to comment.