Enable verify_partial_doubles
This commit is contained in:
		
							parent
							
								
									d6b3f5031a
								
							
						
					
					
						commit
						2255b9d43d
					
				@ -472,7 +472,6 @@ describe Cask::Audit, :cask do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      before do
 | 
					      before do
 | 
				
			||||||
        allow(audit).to receive_messages(download: download_double, signing?: true)
 | 
					        allow(audit).to receive_messages(download: download_double, signing?: true)
 | 
				
			||||||
        allow(audit).to receive(:check_https_availability)
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      context "when cask is not using a signed artifact" do
 | 
					      context "when cask is not using a signed artifact" do
 | 
				
			||||||
@ -1024,7 +1023,6 @@ describe Cask::Audit, :cask do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      before do
 | 
					      before do
 | 
				
			||||||
        allow(audit).to receive(:download).and_return(download_double)
 | 
					        allow(audit).to receive(:download).and_return(download_double)
 | 
				
			||||||
        allow(audit).to receive(:check_https_availability)
 | 
					 | 
				
			||||||
        allow(UnpackStrategy).to receive(:detect).and_return(nil)
 | 
					        allow(UnpackStrategy).to receive(:detect).and_return(nil)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -25,8 +25,6 @@ describe Cask::Upgrade, :cask do
 | 
				
			|||||||
    installed.each do |cask|
 | 
					    installed.each do |cask|
 | 
				
			||||||
      Cask::Installer.new(Cask::CaskLoader.load(cask_path(cask))).install
 | 
					      Cask::Installer.new(Cask::CaskLoader.load(cask_path(cask))).install
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					 | 
				
			||||||
    allow_any_instance_of(described_class).to receive(:verbose?).and_return(true)
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  context "when the upgrade is a dry run" do
 | 
					  context "when the upgrade is a dry run" do
 | 
				
			||||||
 | 
				
			|||||||
@ -235,14 +235,18 @@ describe Homebrew::CLI::Parser do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it "prioritizes cli arguments over env vars when they conflict" do
 | 
					    it "prioritizes cli arguments over env vars when they conflict" do
 | 
				
			||||||
 | 
					      without_partial_double_verification do
 | 
				
			||||||
        allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: false)
 | 
					        allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: false)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
      args = parser.parse(["--switch-b"])
 | 
					      args = parser.parse(["--switch-b"])
 | 
				
			||||||
      expect(args.switch_a?).to be false
 | 
					      expect(args.switch_a?).to be false
 | 
				
			||||||
      expect(args).to be_switch_b
 | 
					      expect(args).to be_switch_b
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it "raises an exception on constraint violation when both are env vars" do
 | 
					    it "raises an exception on constraint violation when both are env vars" do
 | 
				
			||||||
 | 
					      without_partial_double_verification do
 | 
				
			||||||
        allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: true)
 | 
					        allow(Homebrew::EnvConfig).to receive_messages(switch_a?: true, switch_b?: true)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
      expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError)
 | 
					      expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
				
			|||||||
@ -282,7 +282,6 @@ describe FormulaInstaller do
 | 
				
			|||||||
      expect(formula).to receive(:plist).and_return(nil)
 | 
					      expect(formula).to receive(:plist).and_return(nil)
 | 
				
			||||||
      expect(formula).to receive(:service?).exactly(3).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(:launchd_service_path)
 | 
				
			||||||
      expect(formula).not_to receive(:to_systemd_unit)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      installer = described_class.new(formula)
 | 
					      installer = described_class.new(formula)
 | 
				
			||||||
      expect do
 | 
					      expect do
 | 
				
			||||||
 | 
				
			|||||||
@ -11,12 +11,16 @@ describe Language::Node do
 | 
				
			|||||||
        url "node-test-v1.0"
 | 
					        url "node-test-v1.0"
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      stub_formula_loader(node)
 | 
					      stub_formula_loader(node)
 | 
				
			||||||
 | 
					      without_partial_double_verification do
 | 
				
			||||||
        expect(ENV).to receive(:prepend_path)
 | 
					        expect(ENV).to receive(:prepend_path)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
      described_class.instance_variable_set(:@env_set, false)
 | 
					      described_class.instance_variable_set(:@env_set, false)
 | 
				
			||||||
      expect(described_class.setup_npm_environment).to be_nil
 | 
					      expect(described_class.setup_npm_environment).to be_nil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(described_class.instance_variable_get(:@env_set)).to be(true)
 | 
					      expect(described_class.instance_variable_get(:@env_set)).to be(true)
 | 
				
			||||||
 | 
					      without_partial_double_verification do
 | 
				
			||||||
        expect(ENV).not_to receive(:prepend_path)
 | 
					        expect(ENV).not_to receive(:prepend_path)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
      expect(described_class.setup_npm_environment).to be_nil
 | 
					      expect(described_class.setup_npm_environment).to be_nil
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -139,7 +139,9 @@ describe Requirement do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it "infers path from #satisfy result" do
 | 
					      it "infers path from #satisfy result" do
 | 
				
			||||||
 | 
					        without_partial_double_verification do
 | 
				
			||||||
          expect(ENV).to receive(:prepend_path).with("PATH", Pathname.new("/foo/bar"))
 | 
					          expect(ENV).to receive(:prepend_path).with("PATH", Pathname.new("/foo/bar"))
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
        requirement.satisfied?
 | 
					        requirement.satisfied?
 | 
				
			||||||
        requirement.modify_build_environment
 | 
					        requirement.modify_build_environment
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
				
			|||||||
@ -87,6 +87,24 @@ RSpec.configure do |config|
 | 
				
			|||||||
  # identify flaky tests.
 | 
					  # identify flaky tests.
 | 
				
			||||||
  config.default_retry_count = 2 unless ENV["BUILDPULSE"]
 | 
					  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).
 | 
					  # Increase timeouts for integration tests (as we expect them to take longer).
 | 
				
			||||||
  config.around(:each, :integration_test) do |example|
 | 
					  config.around(:each, :integration_test) do |example|
 | 
				
			||||||
    example.metadata[:timeout] ||= 120
 | 
					    example.metadata[:timeout] ||= 120
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user