Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Minitest capitalization #1818

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 5 additions & 5 deletions spec/beaker/dsl/structure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ 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
# caused an error in minitest 5.9.0 trying to write to the file system.
# caused an error in Minitest 5.9.0 trying to write to the file system.
block = lambda { assert(false, 'this assertion should be caught') }
expect{ subject.expect_failure 'this is an expected failure', &block }.not_to raise_error
end
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