Enable verify_partial_doubles

This commit is contained in:
Douglas Eichelberger 2024-02-18 15:08:05 -08:00 committed by Mike McQuaid
parent d6b3f5031a
commit 2255b9d43d
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
7 changed files with 33 additions and 10 deletions

View File

@ -472,7 +472,6 @@ describe Cask::Audit, :cask do
before do
allow(audit).to receive_messages(download: download_double, signing?: true)
allow(audit).to receive(:check_https_availability)
end
context "when cask is not using a signed artifact" do
@ -1024,7 +1023,6 @@ describe Cask::Audit, :cask do
before do
allow(audit).to receive(:download).and_return(download_double)
allow(audit).to receive(:check_https_availability)
allow(UnpackStrategy).to receive(:detect).and_return(nil)
end

View File

@ -25,8 +25,6 @@ describe Cask::Upgrade, :cask do
installed.each do |cask|
Cask::Installer.new(Cask::CaskLoader.load(cask_path(cask))).install
end
allow_any_instance_of(described_class).to receive(:verbose?).and_return(true)
end
context "when the upgrade is a dry run" do

View File

@ -235,14 +235,18 @@ describe Homebrew::CLI::Parser do
end
it "prioritizes cli arguments over env vars when they conflict" do
allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: false)
without_partial_double_verification do
allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: false)
end
args = parser.parse(["--switch-b"])
expect(args.switch_a?).to be false
expect(args).to be_switch_b
end
it "raises an exception on constraint violation when both are env vars" do
allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: true)
without_partial_double_verification do
allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: true)
end
expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError)
end
end

View File

@ -282,7 +282,6 @@ describe FormulaInstaller do
expect(formula).to receive(:plist).and_return(nil)
expect(formula).to receive(:service?).exactly(3).and_return(nil)
expect(formula).not_to receive(:launchd_service_path)
expect(formula).not_to receive(:to_systemd_unit)
installer = described_class.new(formula)
expect do

View File

@ -11,12 +11,16 @@ describe Language::Node do
url "node-test-v1.0"
end
stub_formula_loader(node)
expect(ENV).to receive(:prepend_path)
without_partial_double_verification do
expect(ENV).to receive(:prepend_path)
end
described_class.instance_variable_set(:@env_set, false)
expect(described_class.setup_npm_environment).to be_nil
expect(described_class.instance_variable_get(:@env_set)).to be(true)
expect(ENV).not_to receive(:prepend_path)
without_partial_double_verification do
expect(ENV).not_to receive(:prepend_path)
end
expect(described_class.setup_npm_environment).to be_nil
end

View File

@ -139,7 +139,9 @@ describe Requirement do
end
it "infers path from #satisfy result" do
expect(ENV).to receive(:prepend_path).with("PATH", Pathname.new("/foo/bar"))
without_partial_double_verification do
expect(ENV).to receive(:prepend_path).with("PATH", Pathname.new("/foo/bar"))
end
requirement.satisfied?
requirement.modify_build_environment
end

View File

@ -87,6 +87,24 @@ RSpec.configure do |config|
# identify flaky tests.
config.default_retry_count = 2 unless ENV["BUILDPULSE"]
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
# Increase timeouts for integration tests (as we expect them to take longer).
config.around(:each, :integration_test) do |example|
example.metadata[:timeout] ||= 120