style: remove RSpec/MultipleDescribes violations in commands
This commit is contained in:
		
							parent
							
								
									d5d7b6c3db
								
							
						
					
					
						commit
						4a82d807e1
					
				@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.__cache_args" do
 | 
			
		||||
describe "brew --cache" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew --cache", :integration_test do
 | 
			
		||||
  it "prints all cache files for a given Formula" do
 | 
			
		||||
  it "prints all cache files for a given Formula", :integration_test do
 | 
			
		||||
    expect { brew "--cache", testball }
 | 
			
		||||
      .to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--testball-}o).to_stdout
 | 
			
		||||
      .and output(/Treating #{Regexp.escape(testball)} as a formula/).to_stderr
 | 
			
		||||
@ -19,7 +17,7 @@ describe "brew --cache", :integration_test do
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "prints the cache files for a given Cask" do
 | 
			
		||||
  it "prints the cache files for a given Cask", :integration_test do
 | 
			
		||||
    expect { brew "--cache", cask_path("local-caffeine") }
 | 
			
		||||
      .to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--caffeine\.zip}o).to_stdout
 | 
			
		||||
      .and output(/Treating #{Regexp.escape(cask_path("local-caffeine"))} as a cask/).to_stderr
 | 
			
		||||
@ -30,7 +28,7 @@ describe "brew --cache", :integration_test do
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "prints the cache files for a given Formula and Cask" do
 | 
			
		||||
  it "prints the cache files for a given Formula and Cask", :integration_test do
 | 
			
		||||
    expect { brew "--cache", testball, cask_path("local-caffeine") }
 | 
			
		||||
      .to output(
 | 
			
		||||
        %r{
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.__cellar_args" do
 | 
			
		||||
describe "brew --cellar" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew --cellar", :integration_test do
 | 
			
		||||
  it "returns the Cellar subdirectory for a given Formula" do
 | 
			
		||||
  it "returns the Cellar subdirectory for a given Formula", :integration_test do
 | 
			
		||||
    expect { brew "--cellar", testball }
 | 
			
		||||
      .to output(%r{#{HOMEBREW_CELLAR}/testball}o).to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.__env_args" do
 | 
			
		||||
describe "brew --env" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew --env", :integration_test do
 | 
			
		||||
  describe "--shell=bash" do
 | 
			
		||||
  describe "--shell=bash", :integration_test do
 | 
			
		||||
    it "prints the Homebrew build environment variables in Bash syntax" do
 | 
			
		||||
      expect { brew "--env", "--shell=bash" }
 | 
			
		||||
        .to output(/export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX)}"/).to_stdout
 | 
			
		||||
 | 
			
		||||
@ -3,26 +3,24 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.__prefix_args" do
 | 
			
		||||
describe "brew --prefix" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew --prefix", :integration_test do
 | 
			
		||||
  it "prints a given Formula's prefix" do
 | 
			
		||||
  it "prints a given Formula's prefix", :integration_test do
 | 
			
		||||
    expect { brew "--prefix", testball }
 | 
			
		||||
      .to output(%r{#{HOMEBREW_CELLAR}/testball}o).to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "errors if the given Formula doesn't exist" do
 | 
			
		||||
  it "errors if the given Formula doesn't exist", :integration_test do
 | 
			
		||||
    expect { brew "--prefix", "--installed", "nonexistent" }
 | 
			
		||||
      .to output(/No available formula/).to_stderr
 | 
			
		||||
      .and not_to_output.to_stdout
 | 
			
		||||
      .and be_a_failure
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "prints a warning with `--installed` if the given Formula is not installed" do
 | 
			
		||||
  it "prints a warning with `--installed` if the given Formula is not installed", :integration_test do
 | 
			
		||||
    expect { brew "--prefix", "--installed", testball }
 | 
			
		||||
      .to not_to_output.to_stdout
 | 
			
		||||
      .and output(/testball/).to_stderr
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.__repository_args" do
 | 
			
		||||
describe "brew --repository" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew --repository", :integration_test do
 | 
			
		||||
  it "prints the path of a given Tap" do
 | 
			
		||||
  it "prints the path of a given Tap", :integration_test do
 | 
			
		||||
    expect { brew "--repository", "foo/bar" }
 | 
			
		||||
      .to output("#{HOMEBREW_LIBRARY}/Taps/foo/homebrew-bar\n").to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.__version_args" do
 | 
			
		||||
describe "brew --version" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew --version", :integration_test do
 | 
			
		||||
  it "prints the Homebrew version" do
 | 
			
		||||
  it "prints the Homebrew version", :integration_test do
 | 
			
		||||
    expect { brew "--version" }
 | 
			
		||||
      .to output(/^Homebrew #{Regexp.escape(HOMEBREW_VERSION)}\n/o).to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.analytics_args" do
 | 
			
		||||
describe "brew analytics" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew analytics", :integration_test do
 | 
			
		||||
  it "when HOMEBREW_NO_ANALYTICS is unset is disabled after running `brew analytics off`" do
 | 
			
		||||
  it "when HOMEBREW_NO_ANALYTICS is unset is disabled after running `brew analytics off`", :integration_test do
 | 
			
		||||
    HOMEBREW_REPOSITORY.cd do
 | 
			
		||||
      system "git", "init"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.autoremove_args" do
 | 
			
		||||
describe "brew autoremove" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,11 +3,7 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.cleanup_args" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew cleanup", :integration_test do
 | 
			
		||||
describe "brew cleanup" do
 | 
			
		||||
  before do
 | 
			
		||||
    FileUtils.mkdir_p HOMEBREW_LIBRARY/"Homebrew/vendor/"
 | 
			
		||||
    FileUtils.touch HOMEBREW_LIBRARY/"Homebrew/vendor/portable-ruby-version"
 | 
			
		||||
@ -17,7 +13,9 @@ describe "brew cleanup", :integration_test do
 | 
			
		||||
    FileUtils.rm_rf HOMEBREW_LIBRARY/"Homebrew"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "--prune=all" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
 | 
			
		||||
  describe "--prune=all", :integration_test do
 | 
			
		||||
    it "removes all files in Homebrew's cache" do
 | 
			
		||||
      (HOMEBREW_CACHE/"test").write "test"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,12 +6,10 @@ require "fileutils"
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.commands_args" do
 | 
			
		||||
describe "brew commands" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew commands", :integration_test do
 | 
			
		||||
  it "prints a list of all available commands" do
 | 
			
		||||
  it "prints a list of all available commands", :integration_test do
 | 
			
		||||
    expect { brew "commands" }
 | 
			
		||||
      .to output(/Built-in commands/).to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
 | 
			
		||||
@ -4,9 +4,7 @@
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "brew completions" do
 | 
			
		||||
  describe "Homebrew.completions_args" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "runs the status subcommand correctly", :integration_test do
 | 
			
		||||
    HOMEBREW_REPOSITORY.cd do
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.config_args" do
 | 
			
		||||
describe "brew config" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew config", :integration_test do
 | 
			
		||||
  it "prints information about the current Homebrew configuration" do
 | 
			
		||||
  it "prints information about the current Homebrew configuration", :integration_test do
 | 
			
		||||
    expect { brew "config" }
 | 
			
		||||
      .to output(/HOMEBREW_VERSION: #{Regexp.escape HOMEBREW_VERSION}/o).to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.deps_args" do
 | 
			
		||||
describe "brew deps" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew deps", :integration_test do
 | 
			
		||||
  it "outputs all of a Formula's dependencies and their dependencies on separate lines" do
 | 
			
		||||
  it "outputs all of a Formula's dependencies and their dependencies on separate lines", :integration_test do
 | 
			
		||||
    setup_test_formula "foo"
 | 
			
		||||
    setup_test_formula "bar"
 | 
			
		||||
    setup_test_formula "baz", <<~RUBY
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.desc_args" do
 | 
			
		||||
describe "brew desc" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew desc", :integration_test do
 | 
			
		||||
  it "shows a given Formula's description" do
 | 
			
		||||
  it "shows a given Formula's description", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "desc", "testball" }
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.doctor_args" do
 | 
			
		||||
describe "brew doctor" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew doctor", :integration_test do
 | 
			
		||||
  specify "check_integration_test" do
 | 
			
		||||
  specify "check_integration_test", :integration_test do
 | 
			
		||||
    expect { brew "doctor", "check_integration_test" }
 | 
			
		||||
      .to output(/This is an integration test/).to_stderr
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.fetch_args" do
 | 
			
		||||
describe "brew fetch" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew fetch", :integration_test do
 | 
			
		||||
  it "downloads the Formula's URL" do
 | 
			
		||||
  it "downloads the Formula's URL", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "fetch", "testball" }.to be_a_success
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.gist_logs_args" do
 | 
			
		||||
describe "brew gist-logs" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -4,11 +4,7 @@
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
require "support/lib/config"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.home_args" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew home", :integration_test do
 | 
			
		||||
describe "brew home" do
 | 
			
		||||
  let(:testballhome_homepage) {
 | 
			
		||||
    Formula["testballhome"].homepage
 | 
			
		||||
  }
 | 
			
		||||
@ -21,14 +17,16 @@ describe "brew home", :integration_test do
 | 
			
		||||
    Cask::CaskLoader.load(local_caffeine_path).homepage
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  it "opens the project page when no formula or cask is specified" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
 | 
			
		||||
  it "opens the project page when no formula or cask is specified", :integration_test do
 | 
			
		||||
    expect { brew "home", "HOMEBREW_BROWSER" => "echo" }
 | 
			
		||||
      .to output("https://brew.sh\n").to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "opens the homepage for a given Formula" do
 | 
			
		||||
  it "opens the homepage for a given Formula", :integration_test do
 | 
			
		||||
    setup_test_formula "testballhome"
 | 
			
		||||
 | 
			
		||||
    expect { brew "home", "testballhome", "HOMEBREW_BROWSER" => "echo" }
 | 
			
		||||
@ -37,7 +35,7 @@ describe "brew home", :integration_test do
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "opens the homepage for a given Cask" do
 | 
			
		||||
  it "opens the homepage for a given Cask", :integration_test do
 | 
			
		||||
    expect { brew "home", local_caffeine_path, "HOMEBREW_BROWSER" => "echo" }
 | 
			
		||||
      .to output(/#{local_caffeine_homepage}/).to_stdout
 | 
			
		||||
      .and output(/Treating #{Regexp.escape(local_caffeine_path)} as a cask/).to_stderr
 | 
			
		||||
@ -48,7 +46,7 @@ describe "brew home", :integration_test do
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "opens the homepages for a given formula and Cask" do
 | 
			
		||||
  it "opens the homepages for a given formula and Cask", :integration_test do
 | 
			
		||||
    setup_test_formula "testballhome"
 | 
			
		||||
 | 
			
		||||
    expect { brew "home", "testballhome", local_caffeine_path, "HOMEBREW_BROWSER" => "echo" }
 | 
			
		||||
 | 
			
		||||
@ -5,12 +5,10 @@ require "cmd/info"
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.info_args" do
 | 
			
		||||
describe "brew info" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew info", :integration_test do
 | 
			
		||||
  it "prints as json with the --json=v1 flag" do
 | 
			
		||||
  it "prints as json with the --json=v1 flag", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "info", "testball", "--json=v1" }
 | 
			
		||||
@ -19,7 +17,7 @@ describe "brew info", :integration_test do
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "prints as json with the --json=v2 flag" do
 | 
			
		||||
  it "prints as json with the --json=v2 flag", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "info", "testball", "--json=v2" }
 | 
			
		||||
@ -27,12 +25,12 @@ describe "brew info", :integration_test do
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
  describe Homebrew do
 | 
			
		||||
    describe "::github_remote_path" do
 | 
			
		||||
      let(:remote) { "https://github.com/Homebrew/homebrew-core" }
 | 
			
		||||
 | 
			
		||||
  specify "::github_remote_path" do
 | 
			
		||||
      specify "returns correct URLs" do
 | 
			
		||||
        expect(described_class.github_remote_path(remote, "Formula/git.rb"))
 | 
			
		||||
          .to eq("https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/git.rb")
 | 
			
		||||
 | 
			
		||||
@ -46,3 +44,5 @@ describe Homebrew do
 | 
			
		||||
          .to eq("https://mywebsite.com/foo/bar.rb")
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.install_args" do
 | 
			
		||||
describe "brew install" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew install", :integration_test do
 | 
			
		||||
  it "installs formulae" do
 | 
			
		||||
  it "installs formulae", :integration_test do
 | 
			
		||||
    setup_test_formula "testball1"
 | 
			
		||||
 | 
			
		||||
    expect { brew "install", "testball1" }
 | 
			
		||||
@ -18,7 +16,7 @@ describe "brew install", :integration_test do
 | 
			
		||||
    expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").not_to be_a_file
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "installs formulae with options" do
 | 
			
		||||
  it "installs formulae with options", :integration_test do
 | 
			
		||||
    setup_test_formula "testball1"
 | 
			
		||||
 | 
			
		||||
    expect { brew "install", "testball1", "--with-foo" }
 | 
			
		||||
@ -28,7 +26,7 @@ describe "brew install", :integration_test do
 | 
			
		||||
    expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").to be_a_file
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "can install keg-only Formulae" do
 | 
			
		||||
  it "can install keg-only Formulae", :integration_test do
 | 
			
		||||
    setup_test_formula "testball1", <<~RUBY
 | 
			
		||||
      version "1.0"
 | 
			
		||||
 | 
			
		||||
@ -42,7 +40,7 @@ describe "brew install", :integration_test do
 | 
			
		||||
    expect(HOMEBREW_CELLAR/"testball1/1.0/foo/test").not_to be_a_file
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "can install HEAD Formulae" do
 | 
			
		||||
  it "can install HEAD Formulae", :integration_test do
 | 
			
		||||
    repo_path = HOMEBREW_CACHE.join("repo")
 | 
			
		||||
    repo_path.join("bin").mkpath
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.leaves_args" do
 | 
			
		||||
describe "brew leaves" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew leaves", :integration_test do
 | 
			
		||||
  context "when there are no installed Formulae" do
 | 
			
		||||
  context "when there are no installed Formulae", :integration_test do
 | 
			
		||||
    it "prints nothing" do
 | 
			
		||||
      setup_test_formula "foo"
 | 
			
		||||
      setup_test_formula "bar"
 | 
			
		||||
@ -20,7 +18,7 @@ describe "brew leaves", :integration_test do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context "when there are only installed Formulae without dependencies" do
 | 
			
		||||
  context "when there are only installed Formulae without dependencies", :integration_test do
 | 
			
		||||
    it "prints all installed Formulae" do
 | 
			
		||||
      setup_test_formula "foo"
 | 
			
		||||
      setup_test_formula "bar"
 | 
			
		||||
@ -33,7 +31,7 @@ describe "brew leaves", :integration_test do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context "when there are installed Formulae" do
 | 
			
		||||
  context "when there are installed Formulae", :integration_test do
 | 
			
		||||
    it "prints all installed Formulae that are not dependencies of another installed Formula" do
 | 
			
		||||
      setup_test_formula "foo"
 | 
			
		||||
      setup_test_formula "bar"
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.link_args" do
 | 
			
		||||
describe "brew link" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew link", :integration_test do
 | 
			
		||||
  it "links a given Formula" do
 | 
			
		||||
  it "links a given Formula", :integration_test do
 | 
			
		||||
    install_test_formula "testball"
 | 
			
		||||
    Formula["testball"].any_installed_keg.unlink
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,14 +3,12 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.list_args" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew list", :integration_test do
 | 
			
		||||
describe "brew list" do
 | 
			
		||||
  let(:formulae) { %w[bar foo qux] }
 | 
			
		||||
 | 
			
		||||
  it "prints all installed Formulae" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
 | 
			
		||||
  it "prints all installed Formulae", :integration_test do
 | 
			
		||||
    formulae.each do |f|
 | 
			
		||||
      (HOMEBREW_CELLAR/f/"1.0/somedir").mkpath
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.log_args" do
 | 
			
		||||
describe "brew log" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew log", :integration_test do
 | 
			
		||||
  it "shows the Git log for a given Formula" do
 | 
			
		||||
  it "shows the Git log for a given Formula", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    core_tap = CoreTap.new
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.migrate_args" do
 | 
			
		||||
describe "brew migrate" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew migrate", :integration_test do
 | 
			
		||||
  it "migrates a renamed Formula" do
 | 
			
		||||
  it "migrates a renamed Formula", :integration_test do
 | 
			
		||||
    setup_test_formula "testball1"
 | 
			
		||||
    setup_test_formula "testball2"
 | 
			
		||||
    install_and_rename_coretap_formula "testball1", "testball2"
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.missing_args" do
 | 
			
		||||
describe "brew missing" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew missing", :integration_test do
 | 
			
		||||
  it "prints missing dependencies" do
 | 
			
		||||
  it "prints missing dependencies", :integration_test do
 | 
			
		||||
    setup_test_formula "foo"
 | 
			
		||||
    setup_test_formula "bar"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.options_args" do
 | 
			
		||||
describe "brew options" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew options", :integration_test do
 | 
			
		||||
  it "prints a given Formula's options" do
 | 
			
		||||
  it "prints a given Formula's options", :integration_test do
 | 
			
		||||
    setup_test_formula "testball", <<~RUBY
 | 
			
		||||
      depends_on "bar" => :recommended
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.outdated_args" do
 | 
			
		||||
describe "brew outdated" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew outdated", :integration_test do
 | 
			
		||||
  it "outputs JSON" do
 | 
			
		||||
  it "outputs JSON", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
    (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.pin_args" do
 | 
			
		||||
describe "brew pin" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew pin", :integration_test do
 | 
			
		||||
  it "pins a Formula's version" do
 | 
			
		||||
  it "pins a Formula's version", :integration_test do
 | 
			
		||||
    install_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "pin", "testball" }.to be_a_success
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.postinstall_args" do
 | 
			
		||||
describe "brew postinstall" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.readall_args" do
 | 
			
		||||
describe "brew readall" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew readall", :integration_test do
 | 
			
		||||
  it "imports all Formulae for a given Tap" do
 | 
			
		||||
  it "imports all Formulae for a given Tap", :integration_test do
 | 
			
		||||
    formula_file = setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    alias_file = CoreTap.new.alias_dir/"foobar"
 | 
			
		||||
 | 
			
		||||
@ -4,12 +4,10 @@
 | 
			
		||||
require "extend/ENV"
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.reinstall_args" do
 | 
			
		||||
describe "brew reinstall" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew reinstall", :integration_test do
 | 
			
		||||
  it "reinstalls a Formula" do
 | 
			
		||||
  it "reinstalls a Formula", :integration_test do
 | 
			
		||||
    install_test_formula "testball"
 | 
			
		||||
    foo_dir = HOMEBREW_CELLAR/"testball/0.1/bin"
 | 
			
		||||
    expect(foo_dir).to exist
 | 
			
		||||
 | 
			
		||||
@ -4,12 +4,10 @@
 | 
			
		||||
require "cmd/search"
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.search_args" do
 | 
			
		||||
describe "brew search" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew search", :integration_test do
 | 
			
		||||
  it "falls back to a GitHub tap search when no formula is found", :needs_macos, :needs_network do
 | 
			
		||||
  it "falls back to a GitHub tap search when no formula is found", :integration_test, :needs_macos, :needs_network do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
    setup_remote_tap "homebrew/cask"
 | 
			
		||||
 | 
			
		||||
@ -19,7 +17,7 @@ describe "brew search", :integration_test do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # doesn't actually need Linux but only want one integration test per-OS.
 | 
			
		||||
  it "finds formula in search", :need_linux do
 | 
			
		||||
  it "finds formula in search", :integration_test, :need_linux do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "search", "testball" }
 | 
			
		||||
 | 
			
		||||
@ -2,14 +2,10 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
shared_examples "parseable arguments" do
 | 
			
		||||
  subject(:method_name) do |example|
 | 
			
		||||
    example.metadata[:example_group][:parent_example_group][:description]
 | 
			
		||||
           .delete_prefix("Homebrew.")
 | 
			
		||||
  end
 | 
			
		||||
  subject(:method_name) { "#{command_name.tr("-", "_")}_args" }
 | 
			
		||||
 | 
			
		||||
  let(:command_name) do
 | 
			
		||||
    method_name.delete_suffix("_args")
 | 
			
		||||
               .tr("_", "-")
 | 
			
		||||
  let(:command_name) do |example|
 | 
			
		||||
    example.metadata[:example_group][:parent_example_group][:description].delete_prefix("brew ")
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "can parse arguments" do
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.tap_info_args" do
 | 
			
		||||
describe "brew tap-info" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew tap-info", :integration_test do
 | 
			
		||||
  it "gets information for a given Tap" do
 | 
			
		||||
  it "gets information for a given Tap", :integration_test do
 | 
			
		||||
    setup_test_tap
 | 
			
		||||
 | 
			
		||||
    expect { brew "tap-info", "--json=v1", "--installed" }
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.tap_args" do
 | 
			
		||||
describe "brew tap" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew tap", :integration_test do
 | 
			
		||||
  it "taps a given Tap" do
 | 
			
		||||
  it "taps a given Tap", :integration_test do
 | 
			
		||||
    path = setup_test_tap
 | 
			
		||||
 | 
			
		||||
    expect { brew "tap", "--force-auto-update", "--full", "homebrew/bar", path/".git" }
 | 
			
		||||
 | 
			
		||||
@ -5,12 +5,10 @@ require "cmd/uninstall"
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.uninstall_args" do
 | 
			
		||||
describe "brew uninstall" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew uninstall", :integration_test do
 | 
			
		||||
  it "uninstalls a given Formula" do
 | 
			
		||||
  it "uninstalls a given Formula", :integration_test do
 | 
			
		||||
    install_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "uninstall", "--force", "testball" }
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.unlink_args" do
 | 
			
		||||
describe "brew unlink" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew unlink", :integration_test do
 | 
			
		||||
  it "unlinks a Formula" do
 | 
			
		||||
  it "unlinks a Formula", :integration_test do
 | 
			
		||||
    install_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "unlink", "testball" }
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.unpin_args" do
 | 
			
		||||
describe "brew unpin" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew unpin", :integration_test do
 | 
			
		||||
  it "unpins a Formula's version" do
 | 
			
		||||
  it "unpins a Formula's version", :integration_test do
 | 
			
		||||
    install_test_formula "testball"
 | 
			
		||||
    Formula["testball"].pin
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.untap_args" do
 | 
			
		||||
describe "brew untap" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew untap", :integration_test do
 | 
			
		||||
  it "untaps a given Tap" do
 | 
			
		||||
  it "untaps a given Tap", :integration_test do
 | 
			
		||||
    setup_test_tap
 | 
			
		||||
 | 
			
		||||
    expect { brew "untap", "homebrew/foo" }
 | 
			
		||||
 | 
			
		||||
@ -6,9 +6,8 @@ require "formula_versions"
 | 
			
		||||
require "yaml"
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.update_report_args" do
 | 
			
		||||
describe "brew update-report" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
  describe Reporter do
 | 
			
		||||
    let(:tap) { CoreTap.new }
 | 
			
		||||
@ -133,3 +132,4 @@ describe Reporter do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.upgrade_args" do
 | 
			
		||||
describe "brew upgrade" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew upgrade", :integration_test do
 | 
			
		||||
  it "upgrades a Formula and cleans up old versions" do
 | 
			
		||||
  it "upgrades a Formula and cleans up old versions", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
    (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.uses_args" do
 | 
			
		||||
describe "brew uses" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew uses", :integration_test do
 | 
			
		||||
  it "prints the Formulae a given Formula is used by" do
 | 
			
		||||
  it "prints the Formulae a given Formula is used by", :integration_test do
 | 
			
		||||
    setup_test_formula "foo"
 | 
			
		||||
    setup_test_formula "bar"
 | 
			
		||||
    setup_test_formula "baz", <<~RUBY
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ require "formulary"
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
require "utils/spdx"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.audit_args" do
 | 
			
		||||
describe "brew audit" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,12 +4,10 @@
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
require "dev-cmd/bottle"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.bottle_args" do
 | 
			
		||||
describe "brew bottle" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew bottle", :integration_test do
 | 
			
		||||
  it "builds a bottle for the given Formula" do
 | 
			
		||||
  it "builds a bottle for the given Formula", :integration_test do
 | 
			
		||||
    # create stub patchelf
 | 
			
		||||
    if OS.linux?
 | 
			
		||||
      setup_test_formula "patchelf"
 | 
			
		||||
@ -40,230 +38,8 @@ describe "brew bottle", :integration_test do
 | 
			
		||||
      FileUtils.rm_f Dir.glob("testball--0.1*.bottle.tar.gz")
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def stub_hash(parameters)
 | 
			
		||||
  <<~EOS
 | 
			
		||||
    {
 | 
			
		||||
      "#{parameters[:name]}":{
 | 
			
		||||
         "formula":{
 | 
			
		||||
            "pkg_version":"#{parameters[:version]}",
 | 
			
		||||
            "path":"#{parameters[:path]}"
 | 
			
		||||
         },
 | 
			
		||||
         "bottle":{
 | 
			
		||||
            "root_url":"#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}",
 | 
			
		||||
            "prefix":"/usr/local",
 | 
			
		||||
            "cellar":"#{parameters[:cellar]}",
 | 
			
		||||
            "rebuild":0,
 | 
			
		||||
            "tags":{
 | 
			
		||||
               "#{parameters[:os]}":{
 | 
			
		||||
                  "filename":"#{parameters[:filename]}",
 | 
			
		||||
                  "local_filename":"#{parameters[:local_filename]}",
 | 
			
		||||
                  "sha256":"#{parameters[:sha256]}"
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         },
 | 
			
		||||
         "bintray":{
 | 
			
		||||
            "package":"#{parameters[:name]}",
 | 
			
		||||
            "repository":"bottles"
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  EOS
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe Homebrew do
 | 
			
		||||
  subject(:homebrew) { described_class }
 | 
			
		||||
 | 
			
		||||
  let(:hello_hash_big_sur) {
 | 
			
		||||
    JSON.parse stub_hash(
 | 
			
		||||
      name:           "hello",
 | 
			
		||||
      version:        "1.0",
 | 
			
		||||
      path:           "/home/hello.rb",
 | 
			
		||||
      cellar:         "any_skip_relocation",
 | 
			
		||||
      os:             "big_sur",
 | 
			
		||||
      filename:       "hello-1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
      local_filename: "hello--1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
      sha256:         "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
  let(:hello_hash_catalina) {
 | 
			
		||||
    JSON.parse stub_hash(
 | 
			
		||||
      name:           "hello",
 | 
			
		||||
      version:        "1.0",
 | 
			
		||||
      path:           "/home/hello.rb",
 | 
			
		||||
      cellar:         "any_skip_relocation",
 | 
			
		||||
      os:             "catalina",
 | 
			
		||||
      filename:       "hello-1.0.catalina.bottle.tar.gz",
 | 
			
		||||
      local_filename: "hello--1.0.catalina.bottle.tar.gz",
 | 
			
		||||
      sha256:         "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
  let(:unzip_hash_big_sur) {
 | 
			
		||||
    JSON.parse stub_hash(
 | 
			
		||||
      name:           "unzip",
 | 
			
		||||
      version:        "2.0",
 | 
			
		||||
      path:           "/home/unzip.rb",
 | 
			
		||||
      cellar:         "any_skip_relocation",
 | 
			
		||||
      os:             "big_sur",
 | 
			
		||||
      filename:       "unzip-2.0.big_sur.bottle.tar.gz",
 | 
			
		||||
      local_filename: "unzip--2.0.big_sur.bottle.tar.gz",
 | 
			
		||||
      sha256:         "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
  let(:unzip_hash_catalina) {
 | 
			
		||||
    JSON.parse stub_hash(
 | 
			
		||||
      name:           "unzip",
 | 
			
		||||
      version:        "2.0",
 | 
			
		||||
      path:           "/home/unzip.rb",
 | 
			
		||||
      cellar:         "any",
 | 
			
		||||
      os:             "catalina",
 | 
			
		||||
      filename:       "unzip-2.0.catalina.bottle.tar.gz",
 | 
			
		||||
      local_filename: "unzip--2.0.catalina.bottle.tar.gz",
 | 
			
		||||
      sha256:         "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  specify "::parse_json_files" do
 | 
			
		||||
    Tempfile.open("hello--1.0.big_sur.bottle.json") do |f|
 | 
			
		||||
      f.write stub_hash(
 | 
			
		||||
        name:           "hello",
 | 
			
		||||
        version:        "1.0",
 | 
			
		||||
        path:           "/home/hello.rb",
 | 
			
		||||
        cellar:         "any_skip_relocation",
 | 
			
		||||
        os:             "big_sur",
 | 
			
		||||
        filename:       "hello-1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
        local_filename: "hello--1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
        sha256:         "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
 | 
			
		||||
      )
 | 
			
		||||
      f.close
 | 
			
		||||
      expect(
 | 
			
		||||
        homebrew.parse_json_files([f.path]).first["hello"]["bottle"]["tags"]["big_sur"]["filename"],
 | 
			
		||||
      ).to eq("hello-1.0.big_sur.bottle.tar.gz")
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  specify "::merge_json_files" do
 | 
			
		||||
    bottles_hash = homebrew.merge_json_files(
 | 
			
		||||
      [hello_hash_big_sur, hello_hash_catalina, unzip_hash_big_sur, unzip_hash_catalina],
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    hello_hash = bottles_hash["hello"]
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["big_sur"]["cellar"]).to eq("any_skip_relocation")
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("hello-1.0.big_sur.bottle.tar.gz")
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("hello--1.0.big_sur.bottle.tar.gz")
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
 | 
			
		||||
      "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
 | 
			
		||||
    )
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["catalina"]["cellar"]).to eq("any_skip_relocation")
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("hello-1.0.catalina.bottle.tar.gz")
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("hello--1.0.catalina.bottle.tar.gz")
 | 
			
		||||
    expect(hello_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
 | 
			
		||||
      "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
 | 
			
		||||
    )
 | 
			
		||||
    unzip_hash = bottles_hash["unzip"]
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["big_sur"]["cellar"]).to eq("any_skip_relocation")
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("unzip-2.0.big_sur.bottle.tar.gz")
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("unzip--2.0.big_sur.bottle.tar.gz")
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
 | 
			
		||||
      "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
 | 
			
		||||
    )
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["catalina"]["cellar"]).to eq("any")
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("unzip-2.0.catalina.bottle.tar.gz")
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("unzip--2.0.catalina.bottle.tar.gz")
 | 
			
		||||
    expect(unzip_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
 | 
			
		||||
      "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
 | 
			
		||||
    )
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "#merge_bottle_spec" do
 | 
			
		||||
    it "allows new bottle hash to be empty" do
 | 
			
		||||
      valid_keys = [:root_url, :prefix, :cellar, :rebuild, :sha256]
 | 
			
		||||
      old_spec = BottleSpecification.new
 | 
			
		||||
      old_spec.sha256("f59bc65c91e4e698f6f050e1efea0040f57372d4dcf0996cbb8f97ced320403b" => :big_sur)
 | 
			
		||||
      expect { homebrew.merge_bottle_spec(valid_keys, old_spec, {}) }.not_to raise_error
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "checks for conflicting root URL" do
 | 
			
		||||
      old_spec = BottleSpecification.new
 | 
			
		||||
      old_spec.root_url("https://failbrew.bintray.com/bottles")
 | 
			
		||||
      new_hash = { "root_url" => "https://testbrew.bintray.com/bottles" }
 | 
			
		||||
      expect(homebrew.merge_bottle_spec([:root_url], old_spec, new_hash)).to eq [
 | 
			
		||||
        ['root_url: old: "https://failbrew.bintray.com/bottles", new: "https://testbrew.bintray.com/bottles"'],
 | 
			
		||||
        [],
 | 
			
		||||
      ]
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "checks for conflicting prefix" do
 | 
			
		||||
      old_spec = BottleSpecification.new
 | 
			
		||||
      old_spec.prefix("/opt/failbrew")
 | 
			
		||||
      new_hash = { "prefix" => "/opt/testbrew" }
 | 
			
		||||
      expect(homebrew.merge_bottle_spec([:prefix], old_spec, new_hash)).to eq [
 | 
			
		||||
        ['prefix: old: "/opt/failbrew", new: "/opt/testbrew"'],
 | 
			
		||||
        [],
 | 
			
		||||
      ]
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "checks for conflicting rebuild number" do
 | 
			
		||||
      old_spec = BottleSpecification.new
 | 
			
		||||
      old_spec.rebuild(1)
 | 
			
		||||
      new_hash = { "rebuild" => 2 }
 | 
			
		||||
      expect(homebrew.merge_bottle_spec([:rebuild], old_spec, new_hash)).to eq [
 | 
			
		||||
        ['rebuild: old: "1", new: "2"'],
 | 
			
		||||
        [],
 | 
			
		||||
      ]
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "checks for conflicting checksums" do
 | 
			
		||||
      old_spec = BottleSpecification.new
 | 
			
		||||
      old_spec.sha256(catalina: "109c0cb581a7b5d84da36d84b221fb9dd0f8a927b3044d82611791c9907e202e")
 | 
			
		||||
      old_spec.sha256(mojave: "7571772bf7a0c9fe193e70e521318b53993bee6f351976c9b6e01e00d13d6c3f")
 | 
			
		||||
      new_hash = { "tags" => { "catalina" => "ec6d7f08412468f28dee2be17ad8cd8b883b16b34329efcecce019b8c9736428" } }
 | 
			
		||||
      expected_checksum_hash = { mojave: "7571772bf7a0c9fe193e70e521318b53993bee6f351976c9b6e01e00d13d6c3f" }
 | 
			
		||||
      expected_checksum_hash[:cellar] = Homebrew::DEFAULT_CELLAR
 | 
			
		||||
      expect(homebrew.merge_bottle_spec([:sha256], old_spec, new_hash)).to eq [
 | 
			
		||||
        ["sha256 => catalina"],
 | 
			
		||||
        [expected_checksum_hash],
 | 
			
		||||
      ]
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "::generate_sha256_line" do
 | 
			
		||||
    it "generates a string without cellar" do
 | 
			
		||||
      expect(homebrew.generate_sha256_line(:catalina, "deadbeef", nil)).to eq(
 | 
			
		||||
        <<~RUBY.chomp,
 | 
			
		||||
          sha256 catalina: "deadbeef"
 | 
			
		||||
        RUBY
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "generates a string with cellar symbol" do
 | 
			
		||||
      expect(homebrew.generate_sha256_line(:catalina, "deadbeef", :any)).to eq(
 | 
			
		||||
        <<~RUBY.chomp,
 | 
			
		||||
          sha256 cellar: :any, catalina: "deadbeef"
 | 
			
		||||
        RUBY
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "generates a string with default cellar path" do
 | 
			
		||||
      expect(homebrew.generate_sha256_line(:catalina, "deadbeef", Homebrew::DEFAULT_LINUX_CELLAR)).to eq(
 | 
			
		||||
        <<~RUBY.chomp,
 | 
			
		||||
          sha256 catalina: "deadbeef"
 | 
			
		||||
        RUBY
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "generates a string with non-default cellar path" do
 | 
			
		||||
      expect(homebrew.generate_sha256_line(:catalina, "deadbeef", "/home/test")).to eq(
 | 
			
		||||
        <<~RUBY.chomp,
 | 
			
		||||
          sha256 cellar: "/home/test", catalina: "deadbeef"
 | 
			
		||||
        RUBY
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew bottle --merge", :integration_test do
 | 
			
		||||
  describe "--merge", :integration_test do
 | 
			
		||||
    let(:core_tap) { CoreTap.new }
 | 
			
		||||
    let(:tarball) do
 | 
			
		||||
      if OS.linux?
 | 
			
		||||
@ -503,3 +279,225 @@ describe "brew bottle --merge", :integration_test do
 | 
			
		||||
      EOS
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe Homebrew do
 | 
			
		||||
    subject(:homebrew) { described_class }
 | 
			
		||||
 | 
			
		||||
    let(:hello_hash_big_sur) {
 | 
			
		||||
      JSON.parse stub_hash(
 | 
			
		||||
        name:           "hello",
 | 
			
		||||
        version:        "1.0",
 | 
			
		||||
        path:           "/home/hello.rb",
 | 
			
		||||
        cellar:         "any_skip_relocation",
 | 
			
		||||
        os:             "big_sur",
 | 
			
		||||
        filename:       "hello-1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
        local_filename: "hello--1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
        sha256:         "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
    let(:hello_hash_catalina) {
 | 
			
		||||
      JSON.parse stub_hash(
 | 
			
		||||
        name:           "hello",
 | 
			
		||||
        version:        "1.0",
 | 
			
		||||
        path:           "/home/hello.rb",
 | 
			
		||||
        cellar:         "any_skip_relocation",
 | 
			
		||||
        os:             "catalina",
 | 
			
		||||
        filename:       "hello-1.0.catalina.bottle.tar.gz",
 | 
			
		||||
        local_filename: "hello--1.0.catalina.bottle.tar.gz",
 | 
			
		||||
        sha256:         "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
    let(:unzip_hash_big_sur) {
 | 
			
		||||
      JSON.parse stub_hash(
 | 
			
		||||
        name:           "unzip",
 | 
			
		||||
        version:        "2.0",
 | 
			
		||||
        path:           "/home/unzip.rb",
 | 
			
		||||
        cellar:         "any_skip_relocation",
 | 
			
		||||
        os:             "big_sur",
 | 
			
		||||
        filename:       "unzip-2.0.big_sur.bottle.tar.gz",
 | 
			
		||||
        local_filename: "unzip--2.0.big_sur.bottle.tar.gz",
 | 
			
		||||
        sha256:         "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
    let(:unzip_hash_catalina) {
 | 
			
		||||
      JSON.parse stub_hash(
 | 
			
		||||
        name:           "unzip",
 | 
			
		||||
        version:        "2.0",
 | 
			
		||||
        path:           "/home/unzip.rb",
 | 
			
		||||
        cellar:         "any",
 | 
			
		||||
        os:             "catalina",
 | 
			
		||||
        filename:       "unzip-2.0.catalina.bottle.tar.gz",
 | 
			
		||||
        local_filename: "unzip--2.0.catalina.bottle.tar.gz",
 | 
			
		||||
        sha256:         "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    specify "::parse_json_files" do
 | 
			
		||||
      Tempfile.open("hello--1.0.big_sur.bottle.json") do |f|
 | 
			
		||||
        f.write stub_hash(
 | 
			
		||||
          name:           "hello",
 | 
			
		||||
          version:        "1.0",
 | 
			
		||||
          path:           "/home/hello.rb",
 | 
			
		||||
          cellar:         "any_skip_relocation",
 | 
			
		||||
          os:             "big_sur",
 | 
			
		||||
          filename:       "hello-1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
          local_filename: "hello--1.0.big_sur.bottle.tar.gz",
 | 
			
		||||
          sha256:         "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
 | 
			
		||||
        )
 | 
			
		||||
        f.close
 | 
			
		||||
        expect(
 | 
			
		||||
          homebrew.parse_json_files([f.path]).first["hello"]["bottle"]["tags"]["big_sur"]["filename"],
 | 
			
		||||
        ).to eq("hello-1.0.big_sur.bottle.tar.gz")
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    specify "::merge_json_files" do
 | 
			
		||||
      bottles_hash = homebrew.merge_json_files(
 | 
			
		||||
        [hello_hash_big_sur, hello_hash_catalina, unzip_hash_big_sur, unzip_hash_catalina],
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
      hello_hash = bottles_hash["hello"]
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["big_sur"]["cellar"]).to eq("any_skip_relocation")
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("hello-1.0.big_sur.bottle.tar.gz")
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("hello--1.0.big_sur.bottle.tar.gz")
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
 | 
			
		||||
        "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
 | 
			
		||||
      )
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["catalina"]["cellar"]).to eq("any_skip_relocation")
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("hello-1.0.catalina.bottle.tar.gz")
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("hello--1.0.catalina.bottle.tar.gz")
 | 
			
		||||
      expect(hello_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
 | 
			
		||||
        "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
 | 
			
		||||
      )
 | 
			
		||||
      unzip_hash = bottles_hash["unzip"]
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["big_sur"]["cellar"]).to eq("any_skip_relocation")
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("unzip-2.0.big_sur.bottle.tar.gz")
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("unzip--2.0.big_sur.bottle.tar.gz")
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
 | 
			
		||||
        "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
 | 
			
		||||
      )
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["catalina"]["cellar"]).to eq("any")
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("unzip-2.0.catalina.bottle.tar.gz")
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("unzip--2.0.catalina.bottle.tar.gz")
 | 
			
		||||
      expect(unzip_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
 | 
			
		||||
        "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    describe "#merge_bottle_spec" do
 | 
			
		||||
      it "allows new bottle hash to be empty" do
 | 
			
		||||
        valid_keys = [:root_url, :prefix, :cellar, :rebuild, :sha256]
 | 
			
		||||
        old_spec = BottleSpecification.new
 | 
			
		||||
        old_spec.sha256("f59bc65c91e4e698f6f050e1efea0040f57372d4dcf0996cbb8f97ced320403b" => :big_sur)
 | 
			
		||||
        expect { homebrew.merge_bottle_spec(valid_keys, old_spec, {}) }.not_to raise_error
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "checks for conflicting root URL" do
 | 
			
		||||
        old_spec = BottleSpecification.new
 | 
			
		||||
        old_spec.root_url("https://failbrew.bintray.com/bottles")
 | 
			
		||||
        new_hash = { "root_url" => "https://testbrew.bintray.com/bottles" }
 | 
			
		||||
        expect(homebrew.merge_bottle_spec([:root_url], old_spec, new_hash)).to eq [
 | 
			
		||||
          ['root_url: old: "https://failbrew.bintray.com/bottles", new: "https://testbrew.bintray.com/bottles"'],
 | 
			
		||||
          [],
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "checks for conflicting prefix" do
 | 
			
		||||
        old_spec = BottleSpecification.new
 | 
			
		||||
        old_spec.prefix("/opt/failbrew")
 | 
			
		||||
        new_hash = { "prefix" => "/opt/testbrew" }
 | 
			
		||||
        expect(homebrew.merge_bottle_spec([:prefix], old_spec, new_hash)).to eq [
 | 
			
		||||
          ['prefix: old: "/opt/failbrew", new: "/opt/testbrew"'],
 | 
			
		||||
          [],
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "checks for conflicting rebuild number" do
 | 
			
		||||
        old_spec = BottleSpecification.new
 | 
			
		||||
        old_spec.rebuild(1)
 | 
			
		||||
        new_hash = { "rebuild" => 2 }
 | 
			
		||||
        expect(homebrew.merge_bottle_spec([:rebuild], old_spec, new_hash)).to eq [
 | 
			
		||||
          ['rebuild: old: "1", new: "2"'],
 | 
			
		||||
          [],
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "checks for conflicting checksums" do
 | 
			
		||||
        old_spec = BottleSpecification.new
 | 
			
		||||
        old_spec.sha256(catalina: "109c0cb581a7b5d84da36d84b221fb9dd0f8a927b3044d82611791c9907e202e")
 | 
			
		||||
        old_spec.sha256(mojave: "7571772bf7a0c9fe193e70e521318b53993bee6f351976c9b6e01e00d13d6c3f")
 | 
			
		||||
        new_hash = { "tags" => { "catalina" => "ec6d7f08412468f28dee2be17ad8cd8b883b16b34329efcecce019b8c9736428" } }
 | 
			
		||||
        expected_checksum_hash = { mojave: "7571772bf7a0c9fe193e70e521318b53993bee6f351976c9b6e01e00d13d6c3f" }
 | 
			
		||||
        expected_checksum_hash[:cellar] = Homebrew::DEFAULT_CELLAR
 | 
			
		||||
        expect(homebrew.merge_bottle_spec([:sha256], old_spec, new_hash)).to eq [
 | 
			
		||||
          ["sha256 => catalina"],
 | 
			
		||||
          [expected_checksum_hash],
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    describe "::generate_sha256_line" do
 | 
			
		||||
      it "generates a string without cellar" do
 | 
			
		||||
        expect(homebrew.generate_sha256_line(:catalina, "deadbeef", nil)).to eq(
 | 
			
		||||
          <<~RUBY.chomp,
 | 
			
		||||
            sha256 catalina: "deadbeef"
 | 
			
		||||
          RUBY
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "generates a string with cellar symbol" do
 | 
			
		||||
        expect(homebrew.generate_sha256_line(:catalina, "deadbeef", :any)).to eq(
 | 
			
		||||
          <<~RUBY.chomp,
 | 
			
		||||
            sha256 cellar: :any, catalina: "deadbeef"
 | 
			
		||||
          RUBY
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "generates a string with default cellar path" do
 | 
			
		||||
        expect(homebrew.generate_sha256_line(:catalina, "deadbeef", Homebrew::DEFAULT_LINUX_CELLAR)).to eq(
 | 
			
		||||
          <<~RUBY.chomp,
 | 
			
		||||
            sha256 catalina: "deadbeef"
 | 
			
		||||
          RUBY
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "generates a string with non-default cellar path" do
 | 
			
		||||
        expect(homebrew.generate_sha256_line(:catalina, "deadbeef", "/home/test")).to eq(
 | 
			
		||||
          <<~RUBY.chomp,
 | 
			
		||||
            sha256 cellar: "/home/test", catalina: "deadbeef"
 | 
			
		||||
          RUBY
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def stub_hash(parameters)
 | 
			
		||||
  <<~EOS
 | 
			
		||||
    {
 | 
			
		||||
      "#{parameters[:name]}":{
 | 
			
		||||
         "formula":{
 | 
			
		||||
            "pkg_version":"#{parameters[:version]}",
 | 
			
		||||
            "path":"#{parameters[:path]}"
 | 
			
		||||
         },
 | 
			
		||||
         "bottle":{
 | 
			
		||||
            "root_url":"#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}",
 | 
			
		||||
            "prefix":"/usr/local",
 | 
			
		||||
            "cellar":"#{parameters[:cellar]}",
 | 
			
		||||
            "rebuild":0,
 | 
			
		||||
            "tags":{
 | 
			
		||||
               "#{parameters[:os]}":{
 | 
			
		||||
                  "filename":"#{parameters[:filename]}",
 | 
			
		||||
                  "local_filename":"#{parameters[:local_filename]}",
 | 
			
		||||
                  "sha256":"#{parameters[:sha256]}"
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         },
 | 
			
		||||
         "bintray":{
 | 
			
		||||
            "package":"#{parameters[:name]}",
 | 
			
		||||
            "repository":"bottles"
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  EOS
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.bump_cask_pr_args" do
 | 
			
		||||
describe "brew bump-cask-pr" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.bump_formula_pr_args" do
 | 
			
		||||
describe "brew bump-formula-pr" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.bump_revision_args" do
 | 
			
		||||
describe "brew bump-revision" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.bump_unversioned_casks_args" do
 | 
			
		||||
describe "brew bump-unversioned-casks" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -4,9 +4,7 @@
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "brew bump" do
 | 
			
		||||
  describe "Homebrew.bump_args" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "formula", :integration_test, :needs_network do
 | 
			
		||||
    it "returns data for single valid specified formula" do
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.cat_args" do
 | 
			
		||||
describe "brew cat" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew cat", :integration_test do
 | 
			
		||||
  it "prints the content of a given Formula" do
 | 
			
		||||
  it "prints the content of a given Formula", :integration_test do
 | 
			
		||||
    formula_file = setup_test_formula "testball"
 | 
			
		||||
    content = formula_file.read
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.command_args" do
 | 
			
		||||
describe "brew command" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew command", :integration_test do
 | 
			
		||||
  it "returns the file for a given command" do
 | 
			
		||||
  it "returns the file for a given command", :integration_test do
 | 
			
		||||
    expect { brew "command", "info" }
 | 
			
		||||
      .to output(%r{#{Regexp.escape(HOMEBREW_LIBRARY_PATH)}/cmd/info.rb}o).to_stdout
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
 | 
			
		||||
@ -3,15 +3,13 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.create_args" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew create", :integration_test do
 | 
			
		||||
describe "brew create" do
 | 
			
		||||
  let(:url) { "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" }
 | 
			
		||||
  let(:formula_file) { CoreTap.new.formula_dir/"testball.rb" }
 | 
			
		||||
 | 
			
		||||
  it "creates a new Formula file for a given URL" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
 | 
			
		||||
  it "creates a new Formula file for a given URL", :integration_test do
 | 
			
		||||
    brew "create", url, "HOMEBREW_EDITOR" => "/bin/cat"
 | 
			
		||||
 | 
			
		||||
    expect(formula_file).to exist
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.dispatch_build_bottle_args" do
 | 
			
		||||
describe "brew dispatch-build-bottle" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.edit_args" do
 | 
			
		||||
describe "brew edit" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew edit", :integration_test do
 | 
			
		||||
  it "opens a given Formula in an editor" do
 | 
			
		||||
  it "opens a given Formula in an editor", :integration_test do
 | 
			
		||||
    HOMEBREW_REPOSITORY.cd do
 | 
			
		||||
      system "git", "init"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -3,11 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.extract_args" do
 | 
			
		||||
describe "brew extract" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew extract", :integration_test do
 | 
			
		||||
  context "when extracting a formula" do
 | 
			
		||||
    let!(:target) do
 | 
			
		||||
      path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
 | 
			
		||||
      (path/"Formula").mkpath
 | 
			
		||||
@ -27,7 +26,7 @@ describe "brew extract", :integration_test do
 | 
			
		||||
      { name: target.name, path: path }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  it "retrieves the most recent version of formula" do
 | 
			
		||||
    it "retrieves the most recent version of formula", :integration_test do
 | 
			
		||||
      path = target[:path]/"Formula/testball@0.2.rb"
 | 
			
		||||
      expect { brew "extract", "testball", target[:name] }
 | 
			
		||||
        .to output(/^#{path}$/).to_stdout
 | 
			
		||||
@ -37,7 +36,7 @@ describe "brew extract", :integration_test do
 | 
			
		||||
      expect(Formulary.factory(path).version).to be == "0.2"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  it "retrieves the specified version of formula" do
 | 
			
		||||
    it "retrieves the specified version of formula", :integration_test do
 | 
			
		||||
      path = target[:path]/"Formula/testball@0.1.rb"
 | 
			
		||||
      expect { brew "extract", "testball", target[:name], "--version=0.1" }
 | 
			
		||||
        .to output(/^#{path}$/).to_stdout
 | 
			
		||||
@ -47,7 +46,7 @@ describe "brew extract", :integration_test do
 | 
			
		||||
      expect(Formulary.factory(path).version).to be == "0.1"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  it "retrieves the compatible version of formula" do
 | 
			
		||||
    it "retrieves the compatible version of formula", :integration_test do
 | 
			
		||||
      path = target[:path]/"Formula/testball@0.rb"
 | 
			
		||||
      expect { brew "extract", "testball", target[:name], "--version=0" }
 | 
			
		||||
        .to output(/^#{path}$/).to_stdout
 | 
			
		||||
@ -57,3 +56,4 @@ describe "brew extract", :integration_test do
 | 
			
		||||
      expect(Formulary.factory(path).version).to be == "0.2"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.formula_args" do
 | 
			
		||||
describe "brew formula" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew formula", :integration_test do
 | 
			
		||||
  it "prints a given Formula's path" do
 | 
			
		||||
  it "prints a given Formula's path", :integration_test do
 | 
			
		||||
    formula_file = setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    expect { brew "formula", "testball" }
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.irb_args" do
 | 
			
		||||
describe "brew irb" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew irb", :integration_test do
 | 
			
		||||
  it "starts an interactive Homebrew shell session" do
 | 
			
		||||
  it "starts an interactive Homebrew shell session", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    irb_test = HOMEBREW_TEMP/"irb-test.rb"
 | 
			
		||||
 | 
			
		||||
@ -3,17 +3,13 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.linkage_args" do
 | 
			
		||||
describe "brew linkage" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew linkage", :integration_test do
 | 
			
		||||
  before do
 | 
			
		||||
  it "works when no arguments are provided", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
    (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "works when no arguments are provided" do
 | 
			
		||||
    expect { brew "linkage" }
 | 
			
		||||
      .to be_a_success
 | 
			
		||||
      .and not_to_output.to_stdout
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.livecheck_args" do
 | 
			
		||||
describe "brew livecheck" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew livecheck", :integration_test do
 | 
			
		||||
  it "reports the latest version of a Formula", :needs_network do
 | 
			
		||||
  it "reports the latest version of a Formula", :integration_test, :needs_network do
 | 
			
		||||
    content = <<~RUBY
 | 
			
		||||
      desc "Some test"
 | 
			
		||||
      homepage "https://github.com/Homebrew/brew"
 | 
			
		||||
@ -22,7 +20,7 @@ describe "brew livecheck", :integration_test do
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "gives an error when no arguments are given and there's no watchlist" do
 | 
			
		||||
  it "gives an error when no arguments are given and there's no watchlist", :integration_test do
 | 
			
		||||
    expect { brew "livecheck" }
 | 
			
		||||
      .to output(/Invalid usage: A watchlist file is required when no arguments are given\./).to_stderr
 | 
			
		||||
      .and not_to_output.to_stdout
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.man_args" do
 | 
			
		||||
describe "brew man" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.mirror_args" do
 | 
			
		||||
describe "brew mirror" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.pr_automerge_args" do
 | 
			
		||||
describe "brew pr-automerge" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.pr_publish_args" do
 | 
			
		||||
describe "brew pr-publish" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,9 @@ require "utils/git"
 | 
			
		||||
require "tap"
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "brew pr-pull" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
 | 
			
		||||
  describe Homebrew do
 | 
			
		||||
    let(:formula_rebuild) do
 | 
			
		||||
      <<~EOS
 | 
			
		||||
@ -40,10 +43,6 @@ describe Homebrew do
 | 
			
		||||
    let(:formula_file) { path/"Formula/foo.rb" }
 | 
			
		||||
    let(:path) { (Tap::TAP_DIRECTORY/"homebrew/homebrew-foo").extend(GitRepositoryExtension) }
 | 
			
		||||
 | 
			
		||||
  describe "Homebrew.pr_pull_args" do
 | 
			
		||||
    it_behaves_like "parseable arguments"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
    describe "#autosquash!" do
 | 
			
		||||
      it "squashes a formula correctly" do
 | 
			
		||||
        secondary_author = "Someone Else <me@example.com>"
 | 
			
		||||
@ -103,3 +102,4 @@ describe Homebrew do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.pr_upload_args" do
 | 
			
		||||
describe "brew pr-upload" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.prof_args" do
 | 
			
		||||
describe "brew prof" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.release_notes_args" do
 | 
			
		||||
describe "brew release-notes" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.release_args" do
 | 
			
		||||
describe "brew release" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,21 +3,18 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.ruby_args" do
 | 
			
		||||
describe "brew ruby" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew ruby", :integration_test do
 | 
			
		||||
  it "executes ruby code with Homebrew's libraries loaded" do
 | 
			
		||||
  it "executes ruby code with Homebrew's libraries loaded", :integration_test do
 | 
			
		||||
    expect { brew "ruby", "-e", "exit 0" }
 | 
			
		||||
      .to be_a_success
 | 
			
		||||
      .and not_to_output.to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
  # Doesn't actually need Linux but only running there as integration tests are slow.
 | 
			
		||||
describe "brew ruby -e 'puts \"testball\".f.path'", :integration_test, :needs_linux do
 | 
			
		||||
  describe "-e 'puts \"testball\".f.path'", :integration_test, :needs_linux do
 | 
			
		||||
    let!(:target) do
 | 
			
		||||
      target_path = setup_test_formula "testball"
 | 
			
		||||
      { path: target_path }
 | 
			
		||||
@ -30,3 +27,4 @@ describe "brew ruby -e 'puts \"testball\".f.path'", :integration_test, :needs_li
 | 
			
		||||
        .and not_to_output.to_stderr
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.sh_args" do
 | 
			
		||||
describe "brew sh" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew sh", :integration_test do
 | 
			
		||||
  it "runs a shell with the Homebrew environment" do
 | 
			
		||||
  it "runs a shell with the Homebrew environment", :integration_test do
 | 
			
		||||
    expect { brew "sh", "SHELL" => which("true") }
 | 
			
		||||
      .to output(/Your shell has been configured/).to_stdout
 | 
			
		||||
      .and not_to_output.to_stderr
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.sponsors_args" do
 | 
			
		||||
describe "brew sponsors" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.style_args" do
 | 
			
		||||
describe "brew style" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.tap_new_args" do
 | 
			
		||||
describe "brew tap-new" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew tap-new", :integration_test do
 | 
			
		||||
  it "initializes a new tap with a README file and GitHub Actions CI" do
 | 
			
		||||
  it "initializes a new tap with a README file and GitHub Actions CI", :integration_test do
 | 
			
		||||
    expect { brew "tap-new", "homebrew/foo", "--verbose" }
 | 
			
		||||
      .to be_a_success
 | 
			
		||||
      .and output(%r{homebrew/foo}).to_stdout
 | 
			
		||||
 | 
			
		||||
@ -3,13 +3,11 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.test_args" do
 | 
			
		||||
describe "brew test" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
  # randomly segfaults on Linux with portable-ruby.
 | 
			
		||||
describe "brew test", :integration_test, :needs_macos do
 | 
			
		||||
  it "tests a given Formula" do
 | 
			
		||||
  it "tests a given Formula", :integration_test, :needs_macos do
 | 
			
		||||
    install_test_formula "testball", <<~'RUBY'
 | 
			
		||||
      test do
 | 
			
		||||
        assert_equal "test", shell_output("#{bin}/test")
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.typecheck_args" do
 | 
			
		||||
describe "brew typecheck" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.unbottled_args" do
 | 
			
		||||
describe "brew unbottled" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,10 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.unpack_args" do
 | 
			
		||||
describe "brew unpack" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "brew unpack", :integration_test do
 | 
			
		||||
  it "unpacks a given Formula's archive" do
 | 
			
		||||
  it "unpacks a given Formula's archive", :integration_test do
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    mktmpdir do |path|
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.update_license_data_args" do
 | 
			
		||||
describe "brew update-license-data" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,8 @@
 | 
			
		||||
# typed: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "brew update-python-resources" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
@ -3,6 +3,6 @@
 | 
			
		||||
 | 
			
		||||
require "cmd/shared_examples/args_parse"
 | 
			
		||||
 | 
			
		||||
describe "Homebrew.vendor_gems_args" do
 | 
			
		||||
describe "brew vendor-gems" do
 | 
			
		||||
  it_behaves_like "parseable arguments"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user