Merge pull request #2967 from reitermarkus/shutdown
Silence all specs by default.
This commit is contained in:
commit
7308409684
@ -20,9 +20,7 @@ describe "Accessibility Access", :cask do
|
||||
sudo: true,
|
||||
)
|
||||
|
||||
shutup do
|
||||
installer.enable_accessibility_access
|
||||
end
|
||||
installer.enable_accessibility_access
|
||||
end
|
||||
|
||||
it "warns about disabling accessibility access on old macOS releases" do
|
||||
@ -42,9 +40,7 @@ describe "Accessibility Access", :cask do
|
||||
sudo: true,
|
||||
)
|
||||
|
||||
shutup do
|
||||
installer.enable_accessibility_access
|
||||
end
|
||||
installer.enable_accessibility_access
|
||||
end
|
||||
|
||||
it "can disable accessibility access" do
|
||||
@ -54,9 +50,7 @@ describe "Accessibility Access", :cask do
|
||||
sudo: true,
|
||||
)
|
||||
|
||||
shutup do
|
||||
installer.disable_accessibility_access
|
||||
end
|
||||
installer.disable_accessibility_access
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -17,9 +17,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
expect(source_path).to be_a_directory
|
||||
expect(target_path).not_to exist
|
||||
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path).to be_a_directory
|
||||
expect(source_path).not_to exist
|
||||
@ -40,9 +38,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
appsubdir = cask.staged_path.join("subdir").tap(&:mkpath)
|
||||
FileUtils.mv(source_path, appsubdir)
|
||||
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path).to be_a_directory
|
||||
expect(appsubdir.join("Caffeine.app")).not_to exist
|
||||
@ -53,9 +49,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
staged_app_copy = source_path.sub("Caffeine.app", "Caffeine Deluxe.app")
|
||||
FileUtils.cp_r source_path, staged_app_copy
|
||||
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path).to be_a_directory
|
||||
expect(source_path).not_to exist
|
||||
|
||||
@ -16,9 +16,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
|
||||
describe "install_phase" do
|
||||
it "installs the given app using the proper target directory" do
|
||||
shutup do
|
||||
install_phase
|
||||
end
|
||||
install_phase
|
||||
|
||||
expect(target_path).to be_a_directory
|
||||
expect(source_path).not_to exist
|
||||
@ -39,9 +37,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
appsubdir = cask.staged_path.join("subdir").tap(&:mkpath)
|
||||
FileUtils.mv(source_path, appsubdir)
|
||||
|
||||
shutup do
|
||||
install_phase
|
||||
end
|
||||
install_phase
|
||||
|
||||
expect(target_path).to be_a_directory
|
||||
expect(appsubdir.join("Caffeine.app")).not_to exist
|
||||
@ -52,9 +48,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
staged_app_copy = source_path.sub("Caffeine.app", "Caffeine Deluxe.app")
|
||||
FileUtils.cp_r source_path, staged_app_copy
|
||||
|
||||
shutup do
|
||||
install_phase
|
||||
end
|
||||
install_phase
|
||||
|
||||
expect(target_path).to be_a_directory
|
||||
expect(source_path).not_to exist
|
||||
@ -201,15 +195,11 @@ describe Hbc::Artifact::App, :cask do
|
||||
|
||||
describe "uninstall_phase" do
|
||||
it "deletes managed apps" do
|
||||
shutup do
|
||||
install_phase
|
||||
end
|
||||
install_phase
|
||||
|
||||
expect(target_path).to exist
|
||||
|
||||
shutup do
|
||||
uninstall_phase
|
||||
end
|
||||
uninstall_phase
|
||||
|
||||
expect(target_path).not_to exist
|
||||
end
|
||||
@ -225,9 +215,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
|
||||
describe "app is correctly installed" do
|
||||
it "returns the path to the app" do
|
||||
shutup do
|
||||
install_phase
|
||||
end
|
||||
install_phase
|
||||
|
||||
expect(contents).to eq(["#{target_path} (#{target_path.abv})"])
|
||||
end
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
describe Hbc::Artifact::Binary, :cask do
|
||||
let(:cask) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-binary.rb").tap do |cask|
|
||||
shutup do
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
}
|
||||
let(:expected_path) { Hbc.binarydir.join("binary") }
|
||||
@ -22,18 +20,14 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
}
|
||||
|
||||
it "doesn't link the binary when --no-binaries is specified" do
|
||||
shutup do
|
||||
Hbc::Installer.new(cask, binaries: false).install
|
||||
end
|
||||
|
||||
Hbc::Installer.new(cask, binaries: false).install
|
||||
expect(expected_path).not_to exist
|
||||
end
|
||||
end
|
||||
|
||||
it "links the binary to the proper directory" do
|
||||
shutup do
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
end
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
|
||||
expect(expected_path).to be_a_symlink
|
||||
expect(expected_path.readlink).to exist
|
||||
end
|
||||
@ -41,9 +35,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
context "when the binary is not executable" do
|
||||
let(:cask) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-non-executable-binary.rb").tap do |cask|
|
||||
shutup do
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
}
|
||||
|
||||
@ -53,9 +45,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
expect(FileUtils).to receive(:chmod)
|
||||
.with("+x", cask.staged_path.join("naked_non_executable")).and_call_original
|
||||
|
||||
shutup do
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
end
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
|
||||
expect(expected_path).to be_a_symlink
|
||||
expect(expected_path.readlink).to be_executable
|
||||
@ -66,9 +56,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
FileUtils.touch expected_path
|
||||
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
end
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
}.to raise_error(Hbc::CaskError)
|
||||
|
||||
expect(expected_path).not_to be :symlink?
|
||||
@ -77,9 +65,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
it "clobbers an existing symlink" do
|
||||
expected_path.make_symlink("/tmp")
|
||||
|
||||
shutup do
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
end
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
|
||||
expect(File.readlink(expected_path)).not_to eq("/tmp")
|
||||
end
|
||||
@ -87,9 +73,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
it "creates parent directory if it doesn't exist" do
|
||||
FileUtils.rmdir Hbc.binarydir
|
||||
|
||||
shutup do
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
end
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
|
||||
expect(expected_path.exist?).to be true
|
||||
end
|
||||
@ -97,17 +81,13 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
context "binary is inside an app package" do
|
||||
let(:cask) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-embedded-binary.rb").tap do |cask|
|
||||
shutup do
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
}
|
||||
|
||||
it "links the binary to the proper directory" do
|
||||
shutup do
|
||||
Hbc::Artifact::App.new(cask).install_phase
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
end
|
||||
Hbc::Artifact::App.new(cask).install_phase
|
||||
Hbc::Artifact::Binary.new(cask).install_phase
|
||||
|
||||
expect(expected_path).to be_a_symlink
|
||||
expect(expected_path.readlink).to exist
|
||||
|
||||
@ -21,9 +21,7 @@ describe Hbc::Artifact::Artifact, :cask do
|
||||
end
|
||||
|
||||
it "moves the artifact to the proper directory" do
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path).to be_a_directory
|
||||
expect(source_path).not_to exist
|
||||
@ -33,9 +31,7 @@ describe Hbc::Artifact::Artifact, :cask do
|
||||
target_path.mkpath
|
||||
|
||||
expect {
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
}.to raise_error(Hbc::CaskError)
|
||||
|
||||
expect(source_path).to be_a_directory
|
||||
|
||||
@ -5,9 +5,7 @@ describe Hbc::Artifact::NestedContainer, :cask do
|
||||
InstallHelper.install_without_artifacts(c)
|
||||
end
|
||||
|
||||
shutup do
|
||||
Hbc::Artifact::NestedContainer.new(cask).install_phase
|
||||
end
|
||||
Hbc::Artifact::NestedContainer.new(cask).install_phase
|
||||
|
||||
expect(cask.staged_path.join("MyNestedApp.app")).to be_a_directory
|
||||
end
|
||||
|
||||
@ -3,9 +3,7 @@ describe Hbc::Artifact::Pkg, :cask do
|
||||
let(:fake_system_command) { class_double(Hbc::SystemCommand) }
|
||||
|
||||
before(:each) do
|
||||
shutup do
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
|
||||
describe "install_phase" do
|
||||
@ -19,9 +17,7 @@ describe Hbc::Artifact::Pkg, :cask do
|
||||
print_stdout: true,
|
||||
)
|
||||
|
||||
shutup do
|
||||
pkg.install_phase
|
||||
end
|
||||
pkg.install_phase
|
||||
end
|
||||
end
|
||||
|
||||
@ -61,9 +57,7 @@ describe Hbc::Artifact::Pkg, :cask do
|
||||
print_stdout: true,
|
||||
)
|
||||
|
||||
shutup do
|
||||
pkg.install_phase
|
||||
end
|
||||
pkg.install_phase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -11,9 +11,7 @@ describe Hbc::Artifact::Suite, :cask do
|
||||
end
|
||||
|
||||
it "creates a suite containing the expected app" do
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path.join("Caffeine.app")).to exist
|
||||
end
|
||||
@ -22,9 +20,7 @@ describe Hbc::Artifact::Suite, :cask do
|
||||
target_path.mkpath
|
||||
|
||||
expect {
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
}.to raise_error(Hbc::CaskError)
|
||||
|
||||
expect(source_path).to be_a_directory
|
||||
|
||||
@ -17,9 +17,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
end
|
||||
|
||||
it "installs both apps using the proper target directory" do
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path_mini).to be_a_directory
|
||||
expect(source_path_mini).not_to exist
|
||||
@ -32,9 +30,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-subdir.rb") }
|
||||
|
||||
it "installs both apps using the proper target directory" do
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path_mini).to be_a_directory
|
||||
expect(source_path_mini).not_to exist
|
||||
@ -47,9 +43,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
it "only uses apps when they are specified" do
|
||||
FileUtils.cp_r source_path_mini, source_path_mini.sub("Caffeine Mini.app", "Caffeine Deluxe.app")
|
||||
|
||||
shutup do
|
||||
install_phase.call
|
||||
end
|
||||
install_phase.call
|
||||
|
||||
expect(target_path_mini).to be_a_directory
|
||||
expect(source_path_mini).not_to exist
|
||||
|
||||
@ -5,10 +5,8 @@ describe Hbc::Artifact::Zap, :cask do
|
||||
Hbc::Artifact::Zap.new(cask)
|
||||
}
|
||||
|
||||
before do
|
||||
shutup do
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
before(:each) do
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
|
||||
describe "#uninstall_phase" do
|
||||
|
||||
@ -3,11 +3,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
let(:artifact) { described_class.new(cask, command: fake_system_command) }
|
||||
let(:fake_system_command) { Hbc::FakeSystemCommand }
|
||||
|
||||
subject do
|
||||
shutup do
|
||||
artifact.public_send(:"#{artifact_name}_phase")
|
||||
end
|
||||
end
|
||||
subject { artifact.public_send(:"#{artifact_name}_phase") }
|
||||
|
||||
context "using :launchctl" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_name}-launchctl.rb") }
|
||||
|
||||
@ -39,9 +39,7 @@ describe Hbc::Cask, :cask do
|
||||
end
|
||||
|
||||
it "returns an instance of the Cask from a url" do
|
||||
c = shutup do
|
||||
Hbc::CaskLoader.load("file://#{tap_path}/Casks/local-caffeine.rb")
|
||||
end
|
||||
c = Hbc::CaskLoader.load("file://#{tap_path}/Casks/local-caffeine.rb")
|
||||
expect(c).to be_kind_of(Hbc::Cask)
|
||||
expect(c.token).to eq("local-caffeine")
|
||||
end
|
||||
@ -49,9 +47,8 @@ describe Hbc::Cask, :cask do
|
||||
it "raises an error when failing to download a Cask from a url" do
|
||||
expect {
|
||||
url = "file://#{tap_path}/Casks/notacask.rb"
|
||||
shutup do
|
||||
Hbc::CaskLoader.load(url)
|
||||
end
|
||||
|
||||
Hbc::CaskLoader.load(url)
|
||||
}.to raise_error(Hbc::CaskUnavailableError)
|
||||
end
|
||||
|
||||
|
||||
@ -8,9 +8,7 @@ describe Hbc::CLI::Fetch, :cask do
|
||||
}
|
||||
|
||||
it "allows download the installer of a Cask" do
|
||||
shutup do
|
||||
Hbc::CLI::Fetch.run("local-transmission", "local-caffeine")
|
||||
end
|
||||
Hbc::CLI::Fetch.run("local-transmission", "local-caffeine")
|
||||
expect(Hbc::CurlDownloadStrategy.new(local_transmission).cached_location).to exist
|
||||
expect(Hbc::CurlDownloadStrategy.new(local_caffeine).cached_location).to exist
|
||||
end
|
||||
@ -18,31 +16,23 @@ describe Hbc::CLI::Fetch, :cask do
|
||||
it "prevents double fetch (without nuking existing installation)" do
|
||||
download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission)
|
||||
|
||||
shutup do
|
||||
Hbc::Download.new(local_transmission).perform
|
||||
end
|
||||
Hbc::Download.new(local_transmission).perform
|
||||
old_ctime = File.stat(download_stategy.cached_location).ctime
|
||||
|
||||
shutup do
|
||||
Hbc::CLI::Fetch.run("local-transmission")
|
||||
end
|
||||
Hbc::CLI::Fetch.run("local-transmission")
|
||||
new_ctime = File.stat(download_stategy.cached_location).ctime
|
||||
|
||||
expect(old_ctime.to_i).to eq(new_ctime.to_i)
|
||||
end
|
||||
|
||||
it "allows double fetch with --force" do
|
||||
shutup do
|
||||
Hbc::Download.new(local_transmission).perform
|
||||
end
|
||||
Hbc::Download.new(local_transmission).perform
|
||||
|
||||
download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission)
|
||||
old_ctime = File.stat(download_stategy.cached_location).ctime
|
||||
sleep(1)
|
||||
|
||||
shutup do
|
||||
Hbc::CLI::Fetch.run("local-transmission", "--force")
|
||||
end
|
||||
Hbc::CLI::Fetch.run("local-transmission", "--force")
|
||||
download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission)
|
||||
new_ctime = File.stat(download_stategy.cached_location).ctime
|
||||
|
||||
@ -51,9 +41,7 @@ describe Hbc::CLI::Fetch, :cask do
|
||||
|
||||
it "properly handles Casks that are not present" do
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::CLI::Fetch.run("notacask")
|
||||
end
|
||||
Hbc::CLI::Fetch.run("notacask")
|
||||
}.to raise_error(Hbc::CaskError, "Fetch incomplete.")
|
||||
end
|
||||
|
||||
|
||||
@ -14,9 +14,7 @@ describe Hbc::CLI::Install, :cask do
|
||||
end
|
||||
|
||||
it "allows staging and activation of multiple Casks at once" do
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("local-transmission", "local-caffeine")
|
||||
end
|
||||
Hbc::CLI::Install.run("local-transmission", "local-caffeine")
|
||||
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
expect(Hbc.appdir.join("Transmission.app")).to be_a_directory
|
||||
@ -25,19 +23,13 @@ describe Hbc::CLI::Install, :cask do
|
||||
end
|
||||
|
||||
it "skips double install (without nuking existing installation)" do
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
end
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
end
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
end
|
||||
|
||||
it "prints a warning message on double install" do
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
end
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
|
||||
expect {
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
@ -45,9 +37,7 @@ describe Hbc::CLI::Install, :cask do
|
||||
end
|
||||
|
||||
it "allows double install with --force" do
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
end
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
|
||||
expect {
|
||||
expect {
|
||||
@ -57,9 +47,7 @@ describe Hbc::CLI::Install, :cask do
|
||||
end
|
||||
|
||||
it "skips dependencies with --skip-cask-deps" do
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("with-depends-on-cask-multiple", "--skip-cask-deps")
|
||||
end
|
||||
Hbc::CLI::Install.run("with-depends-on-cask-multiple", "--skip-cask-deps")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")).not_to be_installed
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed
|
||||
@ -67,9 +55,7 @@ describe Hbc::CLI::Install, :cask do
|
||||
|
||||
it "properly handles Casks that are not present" do
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("notacask")
|
||||
end
|
||||
Hbc::CLI::Install.run("notacask")
|
||||
}.to raise_error(Hbc::CaskError, "Install incomplete.")
|
||||
end
|
||||
|
||||
|
||||
@ -48,9 +48,7 @@ describe Hbc::CLI::List, :cask do
|
||||
it "lists the installed files for those Casks" do
|
||||
casks.each(&InstallHelper.method(:install_without_artifacts_with_caskfile))
|
||||
|
||||
shutup do
|
||||
Hbc::Artifact::App.new(transmission).install_phase
|
||||
end
|
||||
Hbc::Artifact::App.new(transmission).install_phase
|
||||
|
||||
expect {
|
||||
Hbc::CLI::List.run("local-transmission", "local-caffeine")
|
||||
|
||||
@ -10,9 +10,8 @@ describe Hbc::CLI::Outdated, :cask do
|
||||
end
|
||||
|
||||
before do
|
||||
shutup do
|
||||
installed.each { |cask| InstallHelper.install_with_caskfile(cask) }
|
||||
end
|
||||
installed.each { |cask| InstallHelper.install_with_caskfile(cask) }
|
||||
|
||||
allow_any_instance_of(described_class).to receive(:verbose?).and_return(true)
|
||||
end
|
||||
|
||||
|
||||
@ -2,9 +2,7 @@ describe Hbc::CLI::Reinstall, :cask do
|
||||
it "displays the reinstallation progress" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
output = Regexp.new <<-EOS.undent
|
||||
==> Downloading file:.*caffeine.zip
|
||||
@ -23,23 +21,18 @@ describe Hbc::CLI::Reinstall, :cask do
|
||||
end
|
||||
|
||||
it "allows reinstalling a Cask" do
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
end
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
|
||||
shutup do
|
||||
Hbc::CLI::Reinstall.run("local-transmission")
|
||||
end
|
||||
Hbc::CLI::Reinstall.run("local-transmission")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
end
|
||||
|
||||
it "allows reinstalling a non installed Cask" do
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed
|
||||
|
||||
shutup do
|
||||
Hbc::CLI::Reinstall.run("local-transmission")
|
||||
end
|
||||
Hbc::CLI::Reinstall.run("local-transmission")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
end
|
||||
end
|
||||
|
||||
@ -75,9 +75,7 @@ describe Hbc::CLI::Search, :cask do
|
||||
end
|
||||
|
||||
it "highlights installed packages" do
|
||||
shutup do
|
||||
Hbc::CLI::Install.run("local-caffeine")
|
||||
end
|
||||
Hbc::CLI::Install.run("local-caffeine")
|
||||
|
||||
expect(Hbc::CLI::Search.highlight_installed("local-caffeine")).to eq(pretty_installed("local-caffeine"))
|
||||
end
|
||||
|
||||
@ -5,9 +5,7 @@ describe Hbc::CLI::Style, :cask do
|
||||
let(:args) { [] }
|
||||
let(:cli) { described_class.new(*args) }
|
||||
|
||||
around do |example|
|
||||
shutup { example.run }
|
||||
end
|
||||
around(&:run)
|
||||
|
||||
describe "#run" do
|
||||
subject { cli.run }
|
||||
|
||||
@ -2,9 +2,7 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
it "displays the uninstallation progress" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
output = Regexp.new <<-EOS.undent
|
||||
==> Uninstalling Cask local-caffeine
|
||||
@ -30,9 +28,7 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
|
||||
it "tries anyway on a non-present Cask when --force is given" do
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::CLI::Uninstall.run("local-caffeine", "--force")
|
||||
end
|
||||
Hbc::CLI::Uninstall.run("local-caffeine", "--force")
|
||||
}.not_to raise_error
|
||||
end
|
||||
|
||||
@ -40,17 +36,13 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
Hbc::Installer.new(transmission).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
Hbc::Installer.new(transmission).install
|
||||
|
||||
expect(caffeine).to be_installed
|
||||
expect(transmission).to be_installed
|
||||
|
||||
shutup do
|
||||
Hbc::CLI::Uninstall.run("local-caffeine", "local-transmission")
|
||||
end
|
||||
Hbc::CLI::Uninstall.run("local-caffeine", "local-transmission")
|
||||
|
||||
expect(caffeine).not_to be_installed
|
||||
expect(Hbc.appdir.join("Transmission.app")).not_to exist
|
||||
@ -61,17 +53,13 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
it "calls `uninstall` before removing artifacts" do
|
||||
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(cask).install
|
||||
end
|
||||
Hbc::Installer.new(cask).install
|
||||
|
||||
expect(cask).to be_installed
|
||||
expect(Hbc.appdir.join("MyFancyApp.app")).to exist
|
||||
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::CLI::Uninstall.run("with-uninstall-script-app")
|
||||
end
|
||||
Hbc::CLI::Uninstall.run("with-uninstall-script-app")
|
||||
}.not_to raise_error
|
||||
|
||||
expect(cask).not_to be_installed
|
||||
@ -81,24 +69,20 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
it "can uninstall Casks when the uninstall script is missing, but only when using `--force`" do
|
||||
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(cask).install
|
||||
end
|
||||
Hbc::Installer.new(cask).install
|
||||
|
||||
expect(cask).to be_installed
|
||||
|
||||
Hbc.appdir.join("MyFancyApp.app").rmtree
|
||||
|
||||
expect { shutup { Hbc::CLI::Uninstall.run("with-uninstall-script-app") } }
|
||||
expect { Hbc::CLI::Uninstall.run("with-uninstall-script-app") }
|
||||
.to output(/does not exist/).to_stderr
|
||||
.and raise_error(Hbc::CaskError, "Uninstall incomplete.")
|
||||
|
||||
expect(cask).to be_installed
|
||||
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::CLI::Uninstall.run("with-uninstall-script-app", "--force")
|
||||
end
|
||||
Hbc::CLI::Uninstall.run("with-uninstall-script-app", "--force")
|
||||
}.not_to raise_error
|
||||
|
||||
expect(cask).not_to be_installed
|
||||
@ -131,17 +115,13 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
end
|
||||
|
||||
it "uninstalls one version at a time" do
|
||||
shutup do
|
||||
Hbc::CLI::Uninstall.run("versioned-cask")
|
||||
end
|
||||
Hbc::CLI::Uninstall.run("versioned-cask")
|
||||
|
||||
expect(caskroom_path.join(first_installed_version)).to exist
|
||||
expect(caskroom_path.join(last_installed_version)).not_to exist
|
||||
expect(caskroom_path).to exist
|
||||
|
||||
shutup do
|
||||
Hbc::CLI::Uninstall.run("versioned-cask")
|
||||
end
|
||||
Hbc::CLI::Uninstall.run("versioned-cask")
|
||||
|
||||
expect(caskroom_path.join(first_installed_version)).not_to exist
|
||||
expect(caskroom_path).not_to exist
|
||||
@ -180,9 +160,7 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
end
|
||||
|
||||
it "can still uninstall those Casks" do
|
||||
shutup do
|
||||
Hbc::CLI::Uninstall.run("ive-been-renamed")
|
||||
end
|
||||
Hbc::CLI::Uninstall.run("ive-been-renamed")
|
||||
|
||||
expect(app).not_to exist
|
||||
expect(caskroom_path).not_to exist
|
||||
|
||||
@ -9,17 +9,13 @@ describe Hbc::CLI::Zap, :cask do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
Hbc::Installer.new(transmission).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
Hbc::Installer.new(transmission).install
|
||||
|
||||
expect(caffeine).to be_installed
|
||||
expect(transmission).to be_installed
|
||||
|
||||
shutup do
|
||||
Hbc::CLI::Zap.run("local-caffeine", "local-transmission")
|
||||
end
|
||||
Hbc::CLI::Zap.run("local-caffeine", "local-transmission")
|
||||
|
||||
expect(caffeine).not_to be_installed
|
||||
expect(Hbc.appdir.join("Caffeine.app")).not_to be_a_symlink
|
||||
@ -33,9 +29,7 @@ describe Hbc::CLI::Zap, :cask do
|
||||
# it "dispatches both uninstall and zap stanzas" do
|
||||
# with_zap = Hbc::CaskLoader.load('with-zap')
|
||||
#
|
||||
# shutup do
|
||||
# Hbc::Installer.new(with_zap).install
|
||||
# end
|
||||
# Hbc::Installer.new(with_zap).install
|
||||
#
|
||||
# with_zap.must_be :installed?
|
||||
#
|
||||
@ -48,9 +42,8 @@ describe Hbc::CLI::Zap, :cask do
|
||||
# Hbc::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rm', '-rf', '--',
|
||||
# Pathname.new('~/Library/Preferences/my.fancy.app.plist').expand_path])
|
||||
#
|
||||
# shutup do
|
||||
# Hbc::CLI::Zap.run('with-zap')
|
||||
# end
|
||||
# Hbc::CLI::Zap.run('with-zap')
|
||||
#
|
||||
# with_zap.wont_be :installed?
|
||||
# end
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ describe Hbc::CLI, :cask do
|
||||
cli = described_class.new("--language=en")
|
||||
expect(cli).to receive(:detect_command_and_arguments).with(no_args)
|
||||
expect(cli).to receive(:exit).with(1)
|
||||
shutup { cli.run }
|
||||
cli.run
|
||||
end
|
||||
|
||||
context "when no option is specified" do
|
||||
@ -36,10 +36,6 @@ describe Hbc::CLI, :cask do
|
||||
allow(noop_command).to receive(:run)
|
||||
end
|
||||
|
||||
around do |example|
|
||||
shutup { example.run }
|
||||
end
|
||||
|
||||
it "passes `--version` along to the subcommand" do
|
||||
version_command = double("CLI::Version")
|
||||
allow(described_class).to receive(:lookup_command).with("--version").and_return(version_command)
|
||||
|
||||
@ -13,9 +13,7 @@ describe Hbc::Container::Naked, :cask do
|
||||
container = Hbc::Container::Naked.new(cask, path, Hbc::FakeSystemCommand)
|
||||
|
||||
expect {
|
||||
shutup do
|
||||
container.extract
|
||||
end
|
||||
container.extract
|
||||
}.not_to raise_error
|
||||
|
||||
expect(Hbc::FakeSystemCommand.system_calls[expected_command]).to eq(1)
|
||||
|
||||
@ -3,9 +3,7 @@
|
||||
describe "Satisfy Dependencies and Requirements", :cask do
|
||||
subject {
|
||||
lambda do
|
||||
shutup do
|
||||
Hbc::Installer.new(cask).install
|
||||
end
|
||||
Hbc::Installer.new(cask).install
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@ -23,9 +23,7 @@ describe "download strategies", :cask do
|
||||
it "calls curl with default arguments for a simple Cask" do
|
||||
allow(downloader).to receive(:curl)
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(downloader).to have_received(:curl).with(
|
||||
cask.url.to_s,
|
||||
@ -41,9 +39,7 @@ describe "download strategies", :cask do
|
||||
curl_args = []
|
||||
allow(downloader).to receive(:curl) { |*args| curl_args = args }
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(curl_args.each_cons(2)).to include(["-A", "Mozilla/25.0.1"])
|
||||
end
|
||||
@ -56,9 +52,7 @@ describe "download strategies", :cask do
|
||||
curl_args = []
|
||||
allow(downloader).to receive(:curl) { |*args| curl_args = args }
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(curl_args.each_cons(2)).to include(["-A", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10) https://caskroom.github.io"])
|
||||
end
|
||||
@ -78,9 +72,7 @@ describe "download strategies", :cask do
|
||||
curl_args = []
|
||||
allow(downloader).to receive(:curl) { |*args| curl_args = args }
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(curl_args.each_cons(2)).to include(["-b", "coo=kie;mon=ster"])
|
||||
end
|
||||
@ -93,9 +85,7 @@ describe "download strategies", :cask do
|
||||
curl_args = []
|
||||
allow(downloader).to receive(:curl) { |*args| curl_args = args }
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(curl_args.each_cons(2)).to include(["-e", "http://somehost/also"])
|
||||
end
|
||||
@ -124,9 +114,7 @@ describe "download strategies", :cask do
|
||||
curl_args = []
|
||||
allow(downloader).to receive(:curl) { |*args| curl_args = args }
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(curl_args.each_cons(2)).to include(["-d", "form=data"])
|
||||
expect(curl_args.each_cons(2)).to include(["-d", "is=good"])
|
||||
@ -140,9 +128,7 @@ describe "download strategies", :cask do
|
||||
curl_args = []
|
||||
allow(downloader).to receive(:curl) { |*args| curl_args = args }
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(curl_args.each_cons(2)).to include(["-X", "POST"])
|
||||
end
|
||||
@ -161,18 +147,14 @@ describe "download strategies", :cask do
|
||||
allow(downloader).to receive(:compress)
|
||||
allow(downloader).to receive(:fetch_repo)
|
||||
|
||||
retval = shutup { downloader.fetch }
|
||||
|
||||
expect(retval).to equal(downloader.tarball_path)
|
||||
expect(downloader.fetch).to equal(downloader.tarball_path)
|
||||
end
|
||||
|
||||
it "calls fetch_repo with default arguments for a simple Cask" do
|
||||
allow(downloader).to receive(:compress)
|
||||
allow(downloader).to receive(:fetch_repo)
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(downloader).to have_received(:fetch_repo).with(
|
||||
downloader.cached_location,
|
||||
@ -183,9 +165,7 @@ describe "download strategies", :cask do
|
||||
it "calls svn with default arguments for a simple Cask" do
|
||||
allow(downloader).to receive(:compress)
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/svn",
|
||||
@ -211,9 +191,7 @@ describe "download strategies", :cask do
|
||||
it "adds svn arguments for :trust_cert" do
|
||||
allow(downloader).to receive(:compress)
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/svn",
|
||||
@ -242,9 +220,7 @@ describe "download strategies", :cask do
|
||||
it "adds svn arguments for :revision" do
|
||||
allow(downloader).to receive(:compress)
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/svn",
|
||||
@ -269,9 +245,7 @@ describe "download strategies", :cask do
|
||||
downloader.cached_location.mkdir
|
||||
}
|
||||
|
||||
shutup do
|
||||
downloader.fetch
|
||||
end
|
||||
downloader.fetch
|
||||
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/tar",
|
||||
@ -299,7 +273,7 @@ describe "download strategies", :cask do
|
||||
# FileUtils.touch(target.join('empty_file.txt'))
|
||||
# File.utime(1000,1000,target.join('empty_file.txt'))
|
||||
# end
|
||||
# expect(shutup { downloader.fetch }).to equal(downloader.tarball_path)
|
||||
# expect(downloader.fetch).to equal(downloader.tarball_path)
|
||||
# d = Hbc::Download.new(cask)
|
||||
# d.send(:_check_sums, downloader.tarball_path, cask.sums)
|
||||
# end
|
||||
|
||||
@ -36,9 +36,7 @@ describe Hbc::DSL, :cask do
|
||||
|
||||
it "will simply warn, not throw an exception" do
|
||||
expect {
|
||||
shutup do
|
||||
attempt_unknown_method.call
|
||||
end
|
||||
attempt_unknown_method.call
|
||||
}.not_to raise_error
|
||||
end
|
||||
end
|
||||
@ -78,12 +76,10 @@ describe Hbc::DSL, :cask do
|
||||
it "may use deprecated DSL version hash syntax" do
|
||||
allow(ENV).to receive(:[]).with("HOMEBREW_DEVELOPER").and_return(nil)
|
||||
|
||||
shutup do
|
||||
expect(cask.token).to eq("with-dsl-version")
|
||||
expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
|
||||
expect(cask.homepage).to eq("http://example.com/")
|
||||
expect(cask.version.to_s).to eq("1.2.3")
|
||||
end
|
||||
expect(cask.token).to eq("with-dsl-version")
|
||||
expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
|
||||
expect(cask.homepage).to eq("http://example.com/")
|
||||
expect(cask.version.to_s).to eq("1.2.3")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,9 +7,7 @@ describe Hbc::Installer, :cask do
|
||||
it "downloads and installs a nice fresh Cask" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory
|
||||
expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory
|
||||
@ -18,9 +16,7 @@ describe Hbc::Installer, :cask do
|
||||
it "works with dmg-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-dmg.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(asset).install
|
||||
end
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
expect(Hbc.caskroom.join("container-dmg", asset.version)).to be_a_directory
|
||||
expect(Hbc.appdir.join("container")).to be_a_file
|
||||
@ -29,9 +25,7 @@ describe Hbc::Installer, :cask do
|
||||
it "works with tar-gz-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-tar-gz.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(asset).install
|
||||
end
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
expect(Hbc.caskroom.join("container-tar-gz", asset.version)).to be_a_directory
|
||||
expect(Hbc.appdir.join("container")).to be_a_file
|
||||
@ -40,9 +34,7 @@ describe Hbc::Installer, :cask do
|
||||
it "works with xar-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xar.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(asset).install
|
||||
end
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
expect(Hbc.caskroom.join("container-xar", asset.version)).to be_a_directory
|
||||
expect(Hbc.appdir.join("container")).to be_a_file
|
||||
@ -51,9 +43,7 @@ describe Hbc::Installer, :cask do
|
||||
it "works with pure bzip2-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-bzip2.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(asset).install
|
||||
end
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
expect(Hbc.caskroom.join("container-bzip2", asset.version)).to be_a_directory
|
||||
expect(Hbc.appdir.join("container-bzip2--#{asset.version}")).to be_a_file
|
||||
@ -62,9 +52,7 @@ describe Hbc::Installer, :cask do
|
||||
it "works with pure gzip-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-gzip.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(asset).install
|
||||
end
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
expect(Hbc.caskroom.join("container-gzip", asset.version)).to be_a_directory
|
||||
expect(Hbc.appdir.join("container")).to be_a_file
|
||||
@ -73,27 +61,21 @@ describe Hbc::Installer, :cask do
|
||||
it "blows up on a bad checksum" do
|
||||
bad_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/bad-checksum.rb")
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::Installer.new(bad_checksum).install
|
||||
end
|
||||
Hbc::Installer.new(bad_checksum).install
|
||||
}.to raise_error(Hbc::CaskSha256MismatchError)
|
||||
end
|
||||
|
||||
it "blows up on a missing checksum" do
|
||||
missing_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/missing-checksum.rb")
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::Installer.new(missing_checksum).install
|
||||
end
|
||||
Hbc::Installer.new(missing_checksum).install
|
||||
}.to raise_error(Hbc::CaskSha256MissingError)
|
||||
end
|
||||
|
||||
it "installs fine if sha256 :no_check is used" do
|
||||
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(no_checksum).install
|
||||
end
|
||||
Hbc::Installer.new(no_checksum).install
|
||||
|
||||
expect(no_checksum).to be_installed
|
||||
end
|
||||
@ -101,18 +83,14 @@ describe Hbc::Installer, :cask do
|
||||
it "fails to install if sha256 :no_check is used with --require-sha" do
|
||||
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::Installer.new(no_checksum, require_sha: true).install
|
||||
end
|
||||
Hbc::Installer.new(no_checksum, require_sha: true).install
|
||||
}.to raise_error(Hbc::CaskNoShasumError)
|
||||
end
|
||||
|
||||
it "installs fine if sha256 :no_check is used with --require-sha and --force" do
|
||||
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(no_checksum, require_sha: true, force: true).install
|
||||
end
|
||||
Hbc::Installer.new(no_checksum, require_sha: true, force: true).install
|
||||
|
||||
expect(no_checksum).to be_installed
|
||||
end
|
||||
@ -140,9 +118,7 @@ describe Hbc::Installer, :cask do
|
||||
it "does not extract __MACOSX directories from zips" do
|
||||
with_macosx_dir = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-macosx-dir.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(with_macosx_dir).install
|
||||
end
|
||||
Hbc::Installer.new(with_macosx_dir).install
|
||||
|
||||
expect(with_macosx_dir.staged_path.join("__MACOSX")).not_to be_a_directory
|
||||
end
|
||||
@ -152,14 +128,10 @@ describe Hbc::Installer, :cask do
|
||||
|
||||
expect(with_auto_updates).not_to be_installed
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(with_auto_updates).install
|
||||
end
|
||||
Hbc::Installer.new(with_auto_updates).install
|
||||
|
||||
expect {
|
||||
shutup do
|
||||
Hbc::Installer.new(with_auto_updates, force: true).install
|
||||
end
|
||||
Hbc::Installer.new(with_auto_updates, force: true).install
|
||||
}.not_to raise_error
|
||||
end
|
||||
|
||||
@ -171,9 +143,7 @@ describe Hbc::Installer, :cask do
|
||||
|
||||
installer = Hbc::Installer.new(transmission)
|
||||
|
||||
shutup do
|
||||
installer.install
|
||||
end
|
||||
installer.install
|
||||
|
||||
expect {
|
||||
installer.install
|
||||
@ -185,21 +155,17 @@ describe Hbc::Installer, :cask do
|
||||
|
||||
expect(transmission).not_to be_installed
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(transmission).install
|
||||
end
|
||||
Hbc::Installer.new(transmission).install
|
||||
|
||||
shutup do
|
||||
expect {
|
||||
Hbc::Installer.new(transmission, force: true).install
|
||||
end # wont_raise
|
||||
}.not_to raise_error
|
||||
end
|
||||
|
||||
it "works naked-pkg-based Casks" do
|
||||
naked_pkg = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-pkg.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(naked_pkg).install
|
||||
end
|
||||
Hbc::Installer.new(naked_pkg).install
|
||||
|
||||
expect(Hbc.caskroom.join("container-pkg", naked_pkg.version, "container.pkg")).to be_a_file
|
||||
end
|
||||
@ -207,9 +173,7 @@ describe Hbc::Installer, :cask do
|
||||
it "works properly with an overridden container :type" do
|
||||
naked_executable = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/naked-executable.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(naked_executable).install
|
||||
end
|
||||
Hbc::Installer.new(naked_executable).install
|
||||
|
||||
expect(Hbc.caskroom.join("naked-executable", naked_executable.version, "naked_executable")).to be_a_file
|
||||
end
|
||||
@ -217,9 +181,7 @@ describe Hbc::Installer, :cask do
|
||||
it "works fine with a nested container" do
|
||||
nested_app = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(nested_app).install
|
||||
end
|
||||
Hbc::Installer.new(nested_app).install
|
||||
|
||||
expect(Hbc.appdir.join("MyNestedApp.app")).to be_a_directory
|
||||
end
|
||||
@ -227,9 +189,7 @@ describe Hbc::Installer, :cask do
|
||||
it "generates and finds a timestamped metadata directory for an installed Cask" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
m_path = caffeine.metadata_timestamped_path(timestamp: :now, create: true)
|
||||
expect(caffeine.metadata_timestamped_path(timestamp: :latest)).to eq(m_path)
|
||||
@ -238,9 +198,7 @@ describe Hbc::Installer, :cask do
|
||||
it "generates and finds a metadata subdirectory for an installed Cask" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
subdir_name = "Casks"
|
||||
m_subdir = caffeine.metadata_subdir(subdir_name, timestamp: :now, create: true)
|
||||
@ -253,10 +211,8 @@ describe Hbc::Installer, :cask do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
installer = Hbc::Installer.new(caffeine)
|
||||
|
||||
shutup do
|
||||
installer.install
|
||||
installer.uninstall
|
||||
end
|
||||
installer.install
|
||||
installer.uninstall
|
||||
|
||||
expect(Hbc.caskroom.join("local-caffeine", caffeine.version, "Caffeine.app")).not_to be_a_directory
|
||||
expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
|
||||
@ -267,9 +223,7 @@ describe Hbc::Installer, :cask do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
mutated_version = caffeine.version + ".1"
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine).install
|
||||
end
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory
|
||||
expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory
|
||||
@ -277,9 +231,7 @@ describe Hbc::Installer, :cask do
|
||||
expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
|
||||
expect(Hbc.caskroom.join("local-caffeine", mutated_version)).to be_a_directory
|
||||
|
||||
shutup do
|
||||
Hbc::Installer.new(caffeine, force: true).uninstall
|
||||
end
|
||||
Hbc::Installer.new(caffeine, force: true).uninstall
|
||||
|
||||
expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
|
||||
expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory
|
||||
|
||||
@ -88,9 +88,7 @@ describe Hbc::Pkg, :cask do
|
||||
allow(pkg).to receive(:root).and_return(fake_root)
|
||||
allow(pkg).to receive(:forget)
|
||||
|
||||
shutup do
|
||||
pkg.uninstall
|
||||
end
|
||||
pkg.uninstall
|
||||
|
||||
expect(fake_dir).to be_a_directory
|
||||
expect(fake_file).not_to be_a_file
|
||||
|
||||
@ -6,10 +6,7 @@ describe "Operations on staged Casks", :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") }
|
||||
let(:installer) { Hbc::Installer.new(cask) }
|
||||
it "fetches the bundle ID from a staged cask" do
|
||||
shutup do
|
||||
installer.install
|
||||
end
|
||||
|
||||
installer.install
|
||||
expect(installer.bundle_identifier).to eq("org.m0k.transmission")
|
||||
end
|
||||
end
|
||||
|
||||
@ -56,7 +56,7 @@ describe Hbc::SystemCommand, :cask do
|
||||
|
||||
shared_examples "it returns '1 2 3 4 5 6'" do
|
||||
describe "its result" do
|
||||
subject { shutup { described_class.run(command, options) } }
|
||||
subject { described_class.run(command, options) }
|
||||
|
||||
it { is_expected.to be_a_success }
|
||||
its(:stdout) { is_expected.to eq([1, 3, 5, nil].join("\n")) }
|
||||
@ -132,7 +132,7 @@ describe Hbc::SystemCommand, :cask do
|
||||
|
||||
it "returns without deadlocking" do
|
||||
wait(15).for {
|
||||
shutup { described_class.run(command, options) }
|
||||
described_class.run(command, options)
|
||||
}.to be_a_success
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,10 +7,6 @@ describe Hbc::Verify::Checksum, :cask do
|
||||
allow(cask).to receive(:sha256).and_return(sha256)
|
||||
end
|
||||
|
||||
around do |example|
|
||||
shutup { example.run }
|
||||
end
|
||||
|
||||
describe ".me?" do
|
||||
subject { described_class.me?(cask) }
|
||||
|
||||
|
||||
@ -11,25 +11,21 @@ describe Formula do
|
||||
describe "#brew" do
|
||||
it "does not raise an error when the checksum matches" do
|
||||
expect {
|
||||
shutup do
|
||||
f = formula do
|
||||
sha256 TESTBALL_SHA256
|
||||
end
|
||||
|
||||
f.brew {}
|
||||
f = formula do
|
||||
sha256 TESTBALL_SHA256
|
||||
end
|
||||
|
||||
f.brew {}
|
||||
}.not_to raise_error
|
||||
end
|
||||
|
||||
it "raises an error when the checksum doesn't match" do
|
||||
expect {
|
||||
shutup do
|
||||
f = formula do
|
||||
sha256 "dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8"
|
||||
end
|
||||
|
||||
f.brew {}
|
||||
f = formula do
|
||||
sha256 "dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8"
|
||||
end
|
||||
|
||||
f.brew {}
|
||||
}.to raise_error(ChecksumMismatchError)
|
||||
end
|
||||
end
|
||||
|
||||
@ -18,9 +18,7 @@ describe Homebrew::Cleanup do
|
||||
|
||||
describe "::cleanup" do
|
||||
it "removes .DS_Store files" do
|
||||
shutup do
|
||||
described_class.cleanup
|
||||
end
|
||||
described_class.cleanup
|
||||
|
||||
expect(ds_store).not_to exist
|
||||
end
|
||||
@ -28,9 +26,7 @@ describe Homebrew::Cleanup do
|
||||
it "doesn't remove anything if `--dry-run` is specified" do
|
||||
ARGV << "--dry-run"
|
||||
|
||||
shutup do
|
||||
described_class.cleanup
|
||||
end
|
||||
described_class.cleanup
|
||||
|
||||
expect(ds_store).to exist
|
||||
end
|
||||
@ -42,14 +38,12 @@ describe Homebrew::Cleanup do
|
||||
|
||||
before(:each) do
|
||||
described_class.instance_variable_set(:@unremovable_kegs, [])
|
||||
shutup do
|
||||
[f1, f2].each do |f|
|
||||
f.brew do
|
||||
f.install
|
||||
end
|
||||
|
||||
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
||||
[f1, f2].each do |f|
|
||||
f.brew do
|
||||
f.install
|
||||
end
|
||||
|
||||
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
||||
end
|
||||
|
||||
allow_any_instance_of(Keg)
|
||||
@ -58,12 +52,12 @@ describe Homebrew::Cleanup do
|
||||
end
|
||||
|
||||
it "doesn't remove any kegs" do
|
||||
shutup { described_class.cleanup_formula f2 }
|
||||
described_class.cleanup_formula f2
|
||||
expect(f1.installed_kegs.size).to eq(2)
|
||||
end
|
||||
|
||||
it "lists the unremovable kegs" do
|
||||
shutup { described_class.cleanup_formula f2 }
|
||||
described_class.cleanup_formula f2
|
||||
expect(described_class.unremovable_kegs).to contain_exactly(f1.installed_kegs[0])
|
||||
end
|
||||
end
|
||||
@ -89,14 +83,12 @@ describe Homebrew::Cleanup do
|
||||
version_scheme 2
|
||||
end.new
|
||||
|
||||
shutup do
|
||||
[f1, f2, f3, f4].each do |f|
|
||||
f.brew do
|
||||
f.install
|
||||
end
|
||||
|
||||
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
||||
[f1, f2, f3, f4].each do |f|
|
||||
f.brew do
|
||||
f.install
|
||||
end
|
||||
|
||||
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
||||
end
|
||||
|
||||
expect(f1).to be_installed
|
||||
@ -104,9 +96,7 @@ describe Homebrew::Cleanup do
|
||||
expect(f3).to be_installed
|
||||
expect(f4).to be_installed
|
||||
|
||||
shutup do
|
||||
described_class.cleanup_formula f3
|
||||
end
|
||||
described_class.cleanup_formula f3
|
||||
|
||||
expect(f1).not_to be_installed
|
||||
expect(f2).not_to be_installed
|
||||
@ -119,9 +109,7 @@ describe Homebrew::Cleanup do
|
||||
path.mkpath
|
||||
ARGV << "--prune=all"
|
||||
|
||||
shutup do
|
||||
described_class.cleanup_logs
|
||||
end
|
||||
described_class.cleanup_logs
|
||||
|
||||
expect(path).not_to exist
|
||||
end
|
||||
@ -131,9 +119,7 @@ describe Homebrew::Cleanup do
|
||||
incomplete = (HOMEBREW_CACHE/"something.incomplete")
|
||||
incomplete.mkpath
|
||||
|
||||
shutup do
|
||||
described_class.cleanup_cache
|
||||
end
|
||||
described_class.cleanup_cache
|
||||
|
||||
expect(incomplete).not_to exist
|
||||
end
|
||||
@ -142,9 +128,7 @@ describe Homebrew::Cleanup do
|
||||
java_cache = (HOMEBREW_CACHE/"java_cache")
|
||||
java_cache.mkpath
|
||||
|
||||
shutup do
|
||||
described_class.cleanup_cache
|
||||
end
|
||||
described_class.cleanup_cache
|
||||
|
||||
expect(java_cache).not_to exist
|
||||
end
|
||||
@ -153,9 +137,7 @@ describe Homebrew::Cleanup do
|
||||
npm_cache = (HOMEBREW_CACHE/"npm_cache")
|
||||
npm_cache.mkpath
|
||||
|
||||
shutup do
|
||||
described_class.cleanup_cache
|
||||
end
|
||||
described_class.cleanup_cache
|
||||
|
||||
expect(npm_cache).not_to exist
|
||||
end
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
describe "brew analytics", :integration_test do
|
||||
before(:each) do
|
||||
HOMEBREW_REPOSITORY.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
end
|
||||
system "git", "init"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -4,10 +4,8 @@ describe "brew bundle", :integration_test, :needs_test_cmd_taps do
|
||||
setup_remote_tap "homebrew/bundle"
|
||||
|
||||
HOMEBREW_REPOSITORY.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "commit", "--allow-empty", "-m", "This is a test commit"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "commit", "--allow-empty", "-m", "This is a test commit"
|
||||
end
|
||||
|
||||
mktmpdir do |path|
|
||||
|
||||
@ -2,9 +2,8 @@ describe "brew cask", :integration_test, :needs_macos, :needs_network do
|
||||
describe "list" do
|
||||
it "returns a list of installed Casks" do
|
||||
setup_remote_tap("caskroom/cask")
|
||||
shutup do
|
||||
expect { brew "cask", "list" }.to be_a_success
|
||||
end
|
||||
|
||||
expect { brew "cask", "list" }.to be_a_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -30,9 +30,7 @@ describe "brew desc", :integration_test do
|
||||
it "creates a description cache" do
|
||||
expect(desc_cache).not_to exist
|
||||
|
||||
shutup do
|
||||
expect { brew "desc", "--description", "testball" }.to be_a_success
|
||||
end
|
||||
expect { brew "desc", "--description", "testball" }.to be_a_success
|
||||
|
||||
expect(desc_cache).to exist
|
||||
end
|
||||
|
||||
@ -4,9 +4,7 @@ describe "brew fetch", :integration_test do
|
||||
|
||||
expect(HOMEBREW_CACHE/"testball-0.1.tbz").not_to exist
|
||||
|
||||
shutup do
|
||||
expect { brew "fetch", "testball" }.to be_a_success
|
||||
end
|
||||
expect { brew "fetch", "testball" }.to be_a_success
|
||||
|
||||
expect(HOMEBREW_CACHE/"testball-0.1.tbz").to exist
|
||||
end
|
||||
|
||||
@ -101,9 +101,7 @@ describe "brew install", :integration_test do
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
|
||||
shutup do
|
||||
expect { brew "switch", "testball1", "3.0" }.to be_a_success
|
||||
end
|
||||
expect { brew "switch", "testball1", "3.0" }.to be_a_success
|
||||
|
||||
expect { brew "install", "testball1" }
|
||||
.to output(/2.0 is already installed/).to_stderr
|
||||
@ -156,14 +154,12 @@ describe "brew install", :integration_test do
|
||||
repo_path.join("bin").mkpath
|
||||
|
||||
repo_path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
FileUtils.touch "bin/something.bin"
|
||||
FileUtils.touch "README"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "Initial repo commit"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
FileUtils.touch "bin/something.bin"
|
||||
FileUtils.touch "README"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "Initial repo commit"
|
||||
end
|
||||
|
||||
setup_test_formula "testball1", <<-EOS.undent
|
||||
|
||||
@ -9,19 +9,15 @@ describe "brew link", :integration_test do
|
||||
it "does not fail if the given Formula is already linked" do
|
||||
setup_test_formula "testball1"
|
||||
|
||||
shutup do
|
||||
expect { brew "install", "testball1" }.to be_a_success
|
||||
expect { brew "link", "testball1" }.to be_a_success
|
||||
end
|
||||
expect { brew "install", "testball1" }.to be_a_success
|
||||
expect { brew "link", "testball1" }.to be_a_success
|
||||
end
|
||||
|
||||
it "links a given Formula" do
|
||||
setup_test_formula "testball1"
|
||||
|
||||
shutup do
|
||||
expect { brew "install", "testball1" }.to be_a_success
|
||||
expect { brew "unlink", "testball1" }.to be_a_success
|
||||
end
|
||||
expect { brew "install", "testball1" }.to be_a_success
|
||||
expect { brew "unlink", "testball1" }.to be_a_success
|
||||
|
||||
expect { brew "link", "--dry-run", "testball1" }
|
||||
.to output(/Would link/).to_stdout
|
||||
@ -44,9 +40,7 @@ describe "brew link", :integration_test do
|
||||
keg_only "just because"
|
||||
EOS
|
||||
|
||||
shutup do
|
||||
expect { brew "install", "testball1" }.to be_a_success
|
||||
end
|
||||
expect { brew "install", "testball1" }.to be_a_success
|
||||
|
||||
expect { brew "link", "testball1", "SHELL" => "/bin/zsh" }
|
||||
.to output(/testball1 is keg-only/).to_stderr
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
describe "brew log", :integration_test do
|
||||
it "shows the Git log for the Homebrew repository when no argument is given" do
|
||||
HOMEBREW_REPOSITORY.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "commit", "--allow-empty", "-m", "This is a test commit"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "commit", "--allow-empty", "-m", "This is a test commit"
|
||||
end
|
||||
|
||||
expect { brew "log" }
|
||||
@ -18,18 +16,15 @@ describe "brew log", :integration_test do
|
||||
|
||||
core_tap = CoreTap.new
|
||||
core_tap.path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "This is a test commit for Testball"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "This is a test commit for Testball"
|
||||
end
|
||||
|
||||
core_tap_url = "file://#{core_tap.path}"
|
||||
shallow_tap = Tap.fetch("homebrew", "shallow")
|
||||
shutup do
|
||||
system "git", "clone", "--depth=1", core_tap_url, shallow_tap.path
|
||||
end
|
||||
|
||||
system "git", "clone", "--depth=1", core_tap_url, shallow_tap.path
|
||||
|
||||
expect { brew "log", "#{shallow_tap}/testball" }
|
||||
.to output(/This is a test commit for Testball/).to_stdout
|
||||
|
||||
@ -28,9 +28,7 @@ describe "brew outdated", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
shutup do
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
end
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
|
||||
expect { brew "outdated", "--verbose" }
|
||||
.to output("testball (0.0.1) < 0.1 [pinned at 0.0.1]\n").to_stdout
|
||||
@ -44,9 +42,7 @@ describe "brew outdated", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
shutup do
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
end
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
|
||||
expected_json = [
|
||||
{
|
||||
|
||||
@ -3,10 +3,8 @@ describe "brew pin", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
shutup do
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
expect { brew "upgrade" }.to be_a_success
|
||||
end
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
expect { brew "upgrade" }.to be_a_success
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").not_to be_a_directory
|
||||
end
|
||||
|
||||
@ -4,9 +4,7 @@ describe "brew reinstall", :integration_test do
|
||||
before(:each) do
|
||||
setup_test_formula "testball"
|
||||
|
||||
shutup do
|
||||
expect { brew "install", "testball", "--with-foo" }.to be_a_success
|
||||
end
|
||||
expect { brew "install", "testball", "--with-foo" }.to be_a_success
|
||||
end
|
||||
|
||||
it "reinstalls a Formula" do
|
||||
|
||||
@ -14,9 +14,7 @@ describe "brew switch", :integration_test do
|
||||
keg_only "just because"
|
||||
EOS
|
||||
|
||||
shutup do
|
||||
expect { brew "install", "testball" }.to be_a_success
|
||||
end
|
||||
expect { brew "install", "testball" }.to be_a_success
|
||||
|
||||
testball_rack = HOMEBREW_CELLAR/"testball"
|
||||
FileUtils.cp_r testball_rack/"0.1", testball_rack/"0.2"
|
||||
|
||||
@ -2,9 +2,7 @@ require "cmd/uninstall"
|
||||
|
||||
describe "brew uninstall", :integration_test do
|
||||
it "uninstalls a given Formula" do
|
||||
shutup do
|
||||
expect { brew "install", testball }.to be_a_success
|
||||
end
|
||||
expect { brew "install", testball }.to be_a_success
|
||||
|
||||
expect { brew "uninstall", "--force", testball }
|
||||
.to output(/Uninstalling testball/).to_stdout
|
||||
|
||||
@ -2,9 +2,7 @@ describe "brew unlink", :integration_test do
|
||||
it "unlinks a Formula" do
|
||||
setup_test_formula "testball"
|
||||
|
||||
shutup do
|
||||
expect { brew "install", "testball" }.to be_a_success
|
||||
end
|
||||
expect { brew "install", "testball" }.to be_a_success
|
||||
|
||||
expect { brew "unlink", "--dry-run", "testball" }
|
||||
.to output(/Would remove/).to_stdout
|
||||
|
||||
@ -3,10 +3,8 @@ describe "brew unpack", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
|
||||
mktmpdir do |path|
|
||||
shutup do
|
||||
expect { brew "unpack", "testball", "--destdir=#{path}" }
|
||||
.to be_a_success
|
||||
end
|
||||
expect { brew "unpack", "testball", "--destdir=#{path}" }
|
||||
.to be_a_success
|
||||
|
||||
expect(path/"testball-0.1").to be_a_directory
|
||||
end
|
||||
|
||||
@ -3,11 +3,9 @@ describe "brew unpin", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
shutup do
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
expect { brew "unpin", "testball" }.to be_a_success
|
||||
expect { brew "upgrade" }.to be_a_success
|
||||
end
|
||||
expect { brew "pin", "testball" }.to be_a_success
|
||||
expect { brew "unpin", "testball" }.to be_a_success
|
||||
expect { brew "upgrade" }.to be_a_success
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
|
||||
end
|
||||
|
||||
@ -3,9 +3,7 @@ describe "brew upgrade", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
shutup do
|
||||
expect { brew "upgrade" }.to be_a_success
|
||||
end
|
||||
expect { brew "upgrade" }.to be_a_success
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
|
||||
end
|
||||
|
||||
@ -174,13 +174,11 @@ describe FormulaAuditor do
|
||||
specify "GithubGistFormula", :needs_compat do
|
||||
ENV.delete("HOMEBREW_DEVELOPER")
|
||||
|
||||
fa = shutup do
|
||||
formula_auditor "foo", <<-EOS.undent
|
||||
class Foo < GithubGistFormula
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
end
|
||||
EOS
|
||||
end
|
||||
fa = formula_auditor "foo", <<-EOS.undent
|
||||
class Foo < GithubGistFormula
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
end
|
||||
EOS
|
||||
|
||||
fa.audit_class
|
||||
expect(fa.problems)
|
||||
@ -388,18 +386,14 @@ describe FormulaAuditor do
|
||||
|
||||
origin_tap_path.mkpath
|
||||
origin_tap_path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "init"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "init"
|
||||
end
|
||||
|
||||
tap_path.mkpath
|
||||
tap_path.cd do
|
||||
shutup do
|
||||
system "git", "clone", origin_tap_path, "."
|
||||
end
|
||||
system "git", "clone", origin_tap_path, "."
|
||||
end
|
||||
end
|
||||
|
||||
@ -423,16 +417,12 @@ describe FormulaAuditor do
|
||||
origin_formula_path.write text
|
||||
|
||||
origin_tap_path.cd do
|
||||
shutup do
|
||||
system "git", "commit", "-am", "commit"
|
||||
end
|
||||
system "git", "commit", "-am", "commit"
|
||||
end
|
||||
|
||||
tap_path.cd do
|
||||
shutup do
|
||||
system "git", "fetch"
|
||||
system "git", "reset", "--hard", "origin/master"
|
||||
end
|
||||
system "git", "fetch"
|
||||
system "git", "reset", "--hard", "origin/master"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
describe "brew bottle", :integration_test do
|
||||
it "builds a bottle for the given Formula" do
|
||||
begin
|
||||
shutup do
|
||||
expect { brew "install", "--build-bottle", testball }
|
||||
.to be_a_success
|
||||
end
|
||||
expect { brew "install", "--build-bottle", testball }
|
||||
.to be_a_success
|
||||
|
||||
expect { brew "bottle", "--no-rebuild", testball }
|
||||
.to output(/Formula not from core or any taps/).to_stderr
|
||||
|
||||
@ -3,9 +3,7 @@ describe "brew create", :integration_test do
|
||||
let(:formula_file) { CoreTap.new.formula_dir/"testball.rb" }
|
||||
|
||||
it "creates a new Formula file for a given URL" do
|
||||
shutup do
|
||||
brew "create", url, "HOMEBREW_EDITOR" => "/bin/cat"
|
||||
end
|
||||
brew "create", url, "HOMEBREW_EDITOR" => "/bin/cat"
|
||||
|
||||
expect(formula_file).to exist
|
||||
expect(formula_file.read).to match(%Q(sha256 "#{TESTBALL_SHA256}"))
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
describe "brew edit", :integration_test do
|
||||
it "opens a given Formula in an editor" do
|
||||
HOMEBREW_REPOSITORY.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
end
|
||||
system "git", "init"
|
||||
end
|
||||
|
||||
setup_test_formula "testball"
|
||||
|
||||
@ -8,10 +8,8 @@ describe "brew pull", :integration_test do
|
||||
|
||||
it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network do
|
||||
CoreTap.instance.path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "checkout", "-b", "new-branch"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "checkout", "-b", "new-branch"
|
||||
end
|
||||
|
||||
expect { brew "pull", "https://jenkins.brew.sh/job/Homebrew\%20Testing/1028/" }
|
||||
|
||||
@ -3,13 +3,11 @@ describe "brew tap", :integration_test do
|
||||
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
||||
path.mkpath
|
||||
path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
FileUtils.touch "readme"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "init"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
FileUtils.touch "readme"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "init"
|
||||
end
|
||||
|
||||
expect { brew "tap" }
|
||||
|
||||
@ -14,9 +14,7 @@ describe "brew test", :integration_test do
|
||||
end
|
||||
|
||||
it "fails when a Formula has no test" do
|
||||
shutup do
|
||||
expect { brew "install", testball }.to be_a_success
|
||||
end
|
||||
expect { brew "install", testball }.to be_a_success
|
||||
|
||||
expect { brew "test", testball }
|
||||
.to output(/testball defines no test/).to_stderr
|
||||
@ -39,9 +37,7 @@ describe "brew test", :integration_test do
|
||||
end
|
||||
EOS
|
||||
|
||||
shutup do
|
||||
expect { brew "install", "testball" }.to be_a_success
|
||||
end
|
||||
expect { brew "install", "testball" }.to be_a_success
|
||||
|
||||
expect { brew "test", "--HEAD", "testball" }
|
||||
.to output(/Testing testball/).to_stdout
|
||||
|
||||
@ -147,18 +147,14 @@ describe GitDownloadStrategy do
|
||||
end
|
||||
|
||||
def git_commit_all
|
||||
shutup do
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "commit number #{@commit_id}"
|
||||
@commit_id += 1
|
||||
end
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "commit number #{@commit_id}"
|
||||
@commit_id += 1
|
||||
end
|
||||
|
||||
def setup_git_repo
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
FileUtils.touch "README"
|
||||
git_commit_all
|
||||
end
|
||||
|
||||
@ -17,9 +17,7 @@ describe FormulaInstaller do
|
||||
expect(formula).to be_bottled
|
||||
expect(formula).to pour_bottle
|
||||
|
||||
shutup do
|
||||
described_class.new(formula).install
|
||||
end
|
||||
described_class.new(formula).install
|
||||
|
||||
keg = Keg.new(formula.prefix)
|
||||
|
||||
|
||||
@ -18,9 +18,7 @@ describe FormulaInstaller do
|
||||
|
||||
installer = described_class.new(formula)
|
||||
|
||||
shutup do
|
||||
installer.install
|
||||
end
|
||||
installer.install
|
||||
|
||||
keg = Keg.new(formula.prefix)
|
||||
|
||||
|
||||
@ -582,11 +582,9 @@ describe Formula do
|
||||
cached_location.cd do
|
||||
FileUtils.touch "LICENSE"
|
||||
|
||||
shutup do
|
||||
system("git", "init")
|
||||
system("git", "add", "--all")
|
||||
system("git", "commit", "-m", "Initial commit")
|
||||
end
|
||||
system("git", "init")
|
||||
system("git", "add", "--all")
|
||||
system("git", "commit", "-m", "Initial commit")
|
||||
end
|
||||
|
||||
f.update_head_version
|
||||
@ -786,11 +784,9 @@ describe Formula do
|
||||
version_scheme(2)
|
||||
end.new
|
||||
|
||||
shutup do
|
||||
[f1, f2, f3, f4].each do |f|
|
||||
f.brew { f.install }
|
||||
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
||||
end
|
||||
[f1, f2, f3, f4].each do |f|
|
||||
f.brew { f.install }
|
||||
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
||||
end
|
||||
|
||||
expect(f1).to be_installed
|
||||
@ -806,18 +802,16 @@ describe Formula do
|
||||
f2 = Class.new(Testball) { version("0.2") }.new
|
||||
f3 = Class.new(Testball) { version("0.3") }.new
|
||||
|
||||
shutup do
|
||||
f1.brew { f1.install }
|
||||
f1.pin
|
||||
f2.brew { f2.install }
|
||||
f3.brew { f3.install }
|
||||
end
|
||||
f1.brew { f1.install }
|
||||
f1.pin
|
||||
f2.brew { f2.install }
|
||||
f3.brew { f3.install }
|
||||
|
||||
expect(f1.prefix).to eq((HOMEBREW_PINNED_KEGS/f1.name).resolved_path)
|
||||
expect(f1).to be_installed
|
||||
expect(f2).to be_installed
|
||||
expect(f3).to be_installed
|
||||
expect(shutup { f3.eligible_kegs_for_cleanup }).to eq([Keg.new(f2.prefix)])
|
||||
expect(f3.eligible_kegs_for_cleanup).to eq([Keg.new(f2.prefix)])
|
||||
end
|
||||
|
||||
specify "with HEAD installed" do
|
||||
@ -1204,11 +1198,9 @@ describe Formula do
|
||||
testball_repo.cd do
|
||||
FileUtils.touch "LICENSE"
|
||||
|
||||
shutup do
|
||||
system("git", "init")
|
||||
system("git", "add", "--all")
|
||||
system("git", "commit", "-m", "Initial commit")
|
||||
end
|
||||
system("git", "init")
|
||||
system("git", "add", "--all")
|
||||
system("git", "commit", "-m", "Initial commit")
|
||||
end
|
||||
|
||||
expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
|
||||
|
||||
@ -84,10 +84,7 @@ describe Formulary do
|
||||
end
|
||||
|
||||
it "returns a Formula when given a URL" do
|
||||
formula = shutup do
|
||||
subject.factory("file://#{formula_path}")
|
||||
end
|
||||
|
||||
formula = subject.factory("file://#{formula_path}")
|
||||
expect(formula).to be_kind_of(Formula)
|
||||
end
|
||||
|
||||
@ -112,9 +109,7 @@ describe Formulary do
|
||||
let(:installer) { FormulaInstaller.new(formula) }
|
||||
|
||||
it "returns a Formula when given a rack" do
|
||||
shutup do
|
||||
installer.install
|
||||
end
|
||||
installer.install
|
||||
|
||||
f = subject.from_rack(formula.rack)
|
||||
expect(f).to be_kind_of(Formula)
|
||||
@ -122,9 +117,7 @@ describe Formulary do
|
||||
end
|
||||
|
||||
it "returns a Formula when given a Keg" do
|
||||
shutup do
|
||||
installer.install
|
||||
end
|
||||
installer.install
|
||||
|
||||
keg = Keg.new(formula.prefix)
|
||||
f = subject.from_keg(keg)
|
||||
@ -206,9 +199,7 @@ describe Formulary do
|
||||
it "prioritizes Formulae from pinned Taps" do
|
||||
begin
|
||||
tap.pin
|
||||
formula = shutup do
|
||||
subject.find_with_priority(formula_name)
|
||||
end
|
||||
formula = subject.find_with_priority(formula_name)
|
||||
expect(formula).to be_kind_of(Formula)
|
||||
expect(formula.path).to eq(tap_path.realpath)
|
||||
ensure
|
||||
|
||||
@ -7,9 +7,7 @@ describe Language::Go do
|
||||
expect(described_class).to receive(:opoo).once
|
||||
|
||||
mktmpdir do |path|
|
||||
shutup do
|
||||
described_class.stage_deps [], path
|
||||
end
|
||||
described_class.stage_deps [], path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -81,9 +81,7 @@ describe Migrator do
|
||||
|
||||
specify "#move_to_new_directory" do
|
||||
keg.unlink
|
||||
shutup do
|
||||
subject.move_to_new_directory
|
||||
end
|
||||
subject.move_to_new_directory
|
||||
|
||||
expect(new_keg_record).to be_a_directory
|
||||
expect(new_keg_record/"bin").to be_a_directory
|
||||
@ -117,9 +115,7 @@ describe Migrator do
|
||||
expect(HOMEBREW_LINKED_KEGS.children.count).to eq(1)
|
||||
expect((HOMEBREW_PREFIX/"opt").children.count).to eq(1)
|
||||
|
||||
shutup do
|
||||
subject.unlink_oldname
|
||||
end
|
||||
subject.unlink_oldname
|
||||
|
||||
expect(HOMEBREW_LINKED_KEGS).not_to exist
|
||||
expect(HOMEBREW_LIBRARY/"bin").not_to exist
|
||||
@ -134,9 +130,7 @@ describe Migrator do
|
||||
FileUtils.touch new_keg_record/"bin"/file
|
||||
end
|
||||
|
||||
shutup do
|
||||
subject.link_newname
|
||||
end
|
||||
subject.link_newname
|
||||
|
||||
expect(HOMEBREW_LINKED_KEGS.children.count).to eq(1)
|
||||
expect((HOMEBREW_PREFIX/"opt").children.count).to eq(1)
|
||||
@ -172,9 +166,7 @@ describe Migrator do
|
||||
tab.source["path"] = old_formula.path.to_s
|
||||
tab.write
|
||||
|
||||
shutup do
|
||||
subject.migrate
|
||||
end
|
||||
subject.migrate
|
||||
|
||||
expect(new_keg_record).to exist
|
||||
expect(old_keg_record.parent).to be_a_symlink
|
||||
|
||||
@ -148,13 +148,11 @@ describe Homebrew::MissingFormula do
|
||||
(tap_path/"deleted-formula.rb").write "placeholder"
|
||||
|
||||
tap_path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "initial state"
|
||||
system "git", "rm", "deleted-formula.rb"
|
||||
system "git", "commit", "-m", "delete formula 'deleted-formula'"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "initial state"
|
||||
system "git", "rm", "deleted-formula.rb"
|
||||
system "git", "commit", "-m", "delete formula 'deleted-formula'"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -21,27 +21,23 @@ describe "patching" do
|
||||
|
||||
matcher :be_patched do
|
||||
match do |formula|
|
||||
shutup do
|
||||
formula.brew do
|
||||
formula.patch
|
||||
s = File.read("libexec/NOOP")
|
||||
expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected"
|
||||
expect(s).to include("ABCD"), "libexec/NOOP was not patched as expected"
|
||||
end
|
||||
formula.brew do
|
||||
formula.patch
|
||||
s = File.read("libexec/NOOP")
|
||||
expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected"
|
||||
expect(s).to include("ABCD"), "libexec/NOOP was not patched as expected"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
matcher :be_sequentially_patched do
|
||||
match do |formula|
|
||||
shutup do
|
||||
formula.brew do
|
||||
formula.patch
|
||||
s = File.read("libexec/NOOP")
|
||||
expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected"
|
||||
expect(s).not_to include("ABCD"), "libexec/NOOP was not patched as expected"
|
||||
expect(s).to include("1234"), "libexec/NOOP was not patched as expected"
|
||||
end
|
||||
formula.brew do
|
||||
formula.patch
|
||||
s = File.read("libexec/NOOP")
|
||||
expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected"
|
||||
expect(s).not_to include("ABCD"), "libexec/NOOP was not patched as expected"
|
||||
expect(s).to include("1234"), "libexec/NOOP was not patched as expected"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -49,10 +45,8 @@ describe "patching" do
|
||||
matcher :miss_apply do
|
||||
match do |formula|
|
||||
expect {
|
||||
shutup do
|
||||
formula.brew do
|
||||
formula.patch
|
||||
end
|
||||
formula.brew do
|
||||
formula.patch
|
||||
end
|
||||
}.to raise_error(MissingApplyError)
|
||||
end
|
||||
@ -128,32 +122,28 @@ describe "patching" do
|
||||
|
||||
specify "single_patch_dsl_with_incorrect_strip" do
|
||||
expect {
|
||||
shutup do
|
||||
f = formula do
|
||||
patch :p0 do
|
||||
url PATCH_URL_A
|
||||
sha256 PATCH_A_SHA256
|
||||
end
|
||||
f = formula do
|
||||
patch :p0 do
|
||||
url PATCH_URL_A
|
||||
sha256 PATCH_A_SHA256
|
||||
end
|
||||
|
||||
f.brew { |formula, _staging| formula.patch }
|
||||
end
|
||||
|
||||
f.brew { |formula, _staging| formula.patch }
|
||||
}.to raise_error(ErrorDuringExecution)
|
||||
end
|
||||
|
||||
specify "single_patch_dsl_with_incorrect_strip_with_apply" do
|
||||
expect {
|
||||
shutup do
|
||||
f = formula do
|
||||
patch :p0 do
|
||||
url TESTBALL_PATCHES_URL
|
||||
sha256 TESTBALL_PATCHES_SHA256
|
||||
apply APPLY_A
|
||||
end
|
||||
f = formula do
|
||||
patch :p0 do
|
||||
url TESTBALL_PATCHES_URL
|
||||
sha256 TESTBALL_PATCHES_SHA256
|
||||
apply APPLY_A
|
||||
end
|
||||
|
||||
f.brew { |formula, _staging| formula.patch }
|
||||
end
|
||||
|
||||
f.brew { |formula, _staging| formula.patch }
|
||||
}.to raise_error(ErrorDuringExecution)
|
||||
end
|
||||
|
||||
@ -261,17 +251,15 @@ describe "patching" do
|
||||
|
||||
specify "single_patch_dsl_with_apply_enoent_fail" do
|
||||
expect {
|
||||
shutup do
|
||||
f = formula do
|
||||
patch do
|
||||
url TESTBALL_PATCHES_URL
|
||||
sha256 TESTBALL_PATCHES_SHA256
|
||||
apply "patches/#{APPLY_A}"
|
||||
end
|
||||
f = formula do
|
||||
patch do
|
||||
url TESTBALL_PATCHES_URL
|
||||
sha256 TESTBALL_PATCHES_SHA256
|
||||
apply "patches/#{APPLY_A}"
|
||||
end
|
||||
|
||||
f.brew { |formula, _staging| formula.patch }
|
||||
end
|
||||
|
||||
f.brew { |formula, _staging| formula.patch }
|
||||
}.to raise_error(ErrorDuringExecution)
|
||||
end
|
||||
end
|
||||
|
||||
@ -126,9 +126,7 @@ describe Resource do
|
||||
expect(fn).to receive(:verify_checksum).and_raise(ChecksumMissingError)
|
||||
expect(fn).to receive(:sha256)
|
||||
|
||||
shutup do
|
||||
subject.verify_download_integrity(fn)
|
||||
end
|
||||
subject.verify_download_integrity(fn)
|
||||
end
|
||||
|
||||
specify "#verify_download_integrity_mismatch" do
|
||||
@ -138,10 +136,8 @@ describe Resource do
|
||||
expect(fn).to receive(:verify_checksum).with(checksum)
|
||||
.and_raise(ChecksumMismatchError.new(fn, checksum, Object.new))
|
||||
|
||||
shutup do
|
||||
expect {
|
||||
subject.verify_download_integrity(fn)
|
||||
}.to raise_error(ChecksumMismatchError)
|
||||
end
|
||||
expect {
|
||||
subject.verify_download_integrity(fn)
|
||||
}.to raise_error(ChecksumMismatchError)
|
||||
end
|
||||
end
|
||||
|
||||
@ -37,11 +37,9 @@ describe Sandbox do
|
||||
|
||||
describe "#exec" do
|
||||
it "fails when writing to file not specified with ##allow_write" do
|
||||
shutup do
|
||||
expect {
|
||||
subject.exec "touch", file
|
||||
}.to raise_error(ErrorDuringExecution)
|
||||
end
|
||||
expect {
|
||||
subject.exec "touch", file
|
||||
}.to raise_error(ErrorDuringExecution)
|
||||
|
||||
expect(file).not_to exist
|
||||
end
|
||||
|
||||
@ -19,7 +19,6 @@ $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/su
|
||||
require "global"
|
||||
require "tap"
|
||||
|
||||
require "test/support/helper/shutup"
|
||||
require "test/support/helper/fixtures"
|
||||
require "test/support/helper/formula"
|
||||
require "test/support/helper/mktmpdir"
|
||||
@ -44,7 +43,6 @@ RSpec.configure do |config|
|
||||
|
||||
config.filter_run_when_matching :focus
|
||||
|
||||
config.include(Test::Helper::Shutup)
|
||||
config.include(Test::Helper::Fixtures)
|
||||
config.include(Test::Helper::Formula)
|
||||
config.include(Test::Helper::MkTmpDir)
|
||||
@ -88,11 +86,25 @@ RSpec.configure do |config|
|
||||
@__argv = ARGV.dup
|
||||
@__env = ENV.to_hash # dup doesn't work on ENV
|
||||
|
||||
unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS")
|
||||
@__stdout = $stdout.clone
|
||||
@__stderr = $stderr.clone
|
||||
$stdout.reopen(File::NULL)
|
||||
$stderr.reopen(File::NULL)
|
||||
end
|
||||
|
||||
example.run
|
||||
ensure
|
||||
ARGV.replace(@__argv)
|
||||
ENV.replace(@__env)
|
||||
|
||||
unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS")
|
||||
$stdout.reopen(@__stdout)
|
||||
$stderr.reopen(@__stderr)
|
||||
@__stdout.close
|
||||
@__stderr.close
|
||||
end
|
||||
|
||||
Tab.clear_cache
|
||||
|
||||
FileUtils.rm_rf [
|
||||
|
||||
@ -1,42 +1,29 @@
|
||||
module InstallHelper
|
||||
module_function
|
||||
|
||||
require "test/support/helper/shutup"
|
||||
extend Test::Helper::Shutup
|
||||
|
||||
def self.install_without_artifacts(cask)
|
||||
Hbc::Installer.new(cask).tap do |i|
|
||||
shutup do
|
||||
i.download
|
||||
i.extract_primary_container
|
||||
end
|
||||
i.download
|
||||
i.extract_primary_container
|
||||
end
|
||||
end
|
||||
|
||||
def self.install_without_artifacts_with_caskfile(cask)
|
||||
Hbc::Installer.new(cask).tap do |i|
|
||||
shutup do
|
||||
i.download
|
||||
i.extract_primary_container
|
||||
i.save_caskfile
|
||||
end
|
||||
i.download
|
||||
i.extract_primary_container
|
||||
i.save_caskfile
|
||||
end
|
||||
end
|
||||
|
||||
def install_without_artifacts(cask)
|
||||
Hbc::Installer.new(cask).tap do |i|
|
||||
shutup do
|
||||
i.download
|
||||
i.extract_primary_container
|
||||
end
|
||||
i.download
|
||||
i.extract_primary_container
|
||||
end
|
||||
end
|
||||
|
||||
def install_with_caskfile(cask)
|
||||
Hbc::Installer.new(cask).tap do |i|
|
||||
shutup do
|
||||
i.save_caskfile
|
||||
end
|
||||
end
|
||||
Hbc::Installer.new(cask).tap(&:save_caskfile)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
module Test
|
||||
module Helper
|
||||
module Shutup
|
||||
def shutup
|
||||
if ENV.key?("VERBOSE_TESTS")
|
||||
yield
|
||||
else
|
||||
begin
|
||||
tmperr = $stderr.clone
|
||||
tmpout = $stdout.clone
|
||||
$stderr.reopen("/dev/null")
|
||||
$stdout.reopen("/dev/null")
|
||||
yield
|
||||
ensure
|
||||
$stderr.reopen(tmperr)
|
||||
$stdout.reopen(tmpout)
|
||||
tmperr.close
|
||||
tmpout.close
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -171,22 +171,20 @@ RSpec.shared_context "integration test" do
|
||||
end
|
||||
|
||||
def install_and_rename_coretap_formula(old_name, new_name)
|
||||
shutup do
|
||||
CoreTap.instance.path.cd do |tap_path|
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m",
|
||||
"#{old_name.capitalize} has not yet been renamed"
|
||||
CoreTap.instance.path.cd do |tap_path|
|
||||
system "git", "init"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m",
|
||||
"#{old_name.capitalize} has not yet been renamed"
|
||||
|
||||
brew "install", old_name
|
||||
brew "install", old_name
|
||||
|
||||
(tap_path/"Formula/#{old_name}.rb").unlink
|
||||
(tap_path/"formula_renames.json").write JSON.generate(old_name => new_name)
|
||||
(tap_path/"Formula/#{old_name}.rb").unlink
|
||||
(tap_path/"formula_renames.json").write JSON.generate(old_name => new_name)
|
||||
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m",
|
||||
"#{old_name.capitalize} has been renamed to #{new_name.capitalize}"
|
||||
end
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m",
|
||||
"#{old_name.capitalize} has been renamed to #{new_name.capitalize}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -18,9 +18,7 @@ shared_examples Hbc::Staged do
|
||||
["echo", "homebrew-cask", "rocks!"],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.system_command("echo", args: ["homebrew-cask", "rocks!"])
|
||||
end
|
||||
staged.system_command("echo", args: ["homebrew-cask", "rocks!"])
|
||||
end
|
||||
|
||||
it "can get the Info.plist file for the primary app" do
|
||||
@ -34,9 +32,7 @@ shared_examples Hbc::Staged do
|
||||
["/usr/libexec/PlistBuddy", "-c", "Print CFBundleIdentifier", staged.info_plist_file],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.plist_exec("Print CFBundleIdentifier")
|
||||
end
|
||||
staged.plist_exec("Print CFBundleIdentifier")
|
||||
end
|
||||
|
||||
it "can set a key in the Info.plist file" do
|
||||
@ -46,9 +42,7 @@ shared_examples Hbc::Staged do
|
||||
["/usr/libexec/PlistBuddy", "-c", "Set :JVMOptions:JVMVersion 1.6+", staged.info_plist_file],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.plist_set(":JVMOptions:JVMVersion", "1.6+")
|
||||
end
|
||||
staged.plist_set(":JVMOptions:JVMVersion", "1.6+")
|
||||
end
|
||||
|
||||
it "can set the permissions of a file" do
|
||||
@ -59,9 +53,7 @@ shared_examples Hbc::Staged do
|
||||
["/bin/chmod", "-R", "--", "777", fake_pathname],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.set_permissions(fake_pathname.to_s, "777")
|
||||
end
|
||||
staged.set_permissions(fake_pathname.to_s, "777")
|
||||
end
|
||||
|
||||
it "can set the permissions of multiple files" do
|
||||
@ -72,9 +64,7 @@ shared_examples Hbc::Staged do
|
||||
["/bin/chmod", "-R", "--", "777", fake_pathname, fake_pathname],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777")
|
||||
end
|
||||
staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777")
|
||||
end
|
||||
|
||||
it "cannot set the permissions of a file that does not exist" do
|
||||
@ -93,9 +83,7 @@ shared_examples Hbc::Staged do
|
||||
["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.set_ownership(fake_pathname.to_s)
|
||||
end
|
||||
staged.set_ownership(fake_pathname.to_s)
|
||||
end
|
||||
|
||||
it "can set the ownership of multiple files" do
|
||||
@ -108,9 +96,7 @@ shared_examples Hbc::Staged do
|
||||
["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname, fake_pathname],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s])
|
||||
end
|
||||
staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s])
|
||||
end
|
||||
|
||||
it "can set the ownership of a file with a different user and group" do
|
||||
@ -122,9 +108,7 @@ shared_examples Hbc::Staged do
|
||||
["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "other_user:other_group", fake_pathname],
|
||||
)
|
||||
|
||||
shutup do
|
||||
staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group")
|
||||
end
|
||||
staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group")
|
||||
end
|
||||
|
||||
it "cannot set the ownership of a file that does not exist" do
|
||||
@ -132,8 +116,6 @@ shared_examples Hbc::Staged do
|
||||
fake_pathname = non_existent_path
|
||||
allow(staged).to receive(:Pathname).and_return(fake_pathname)
|
||||
|
||||
shutup do
|
||||
staged.set_ownership(fake_pathname.to_s)
|
||||
end
|
||||
staged.set_ownership(fake_pathname.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
@ -52,12 +52,10 @@ describe Tap do
|
||||
|
||||
def setup_git_repo
|
||||
path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "init"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
|
||||
system "git", "add", "--all"
|
||||
system "git", "commit", "-m", "init"
|
||||
end
|
||||
end
|
||||
|
||||
@ -104,7 +102,7 @@ describe Tap do
|
||||
path = Tap::TAP_DIRECTORY/"someone/homebrew-foo"
|
||||
path.mkpath
|
||||
cd path do
|
||||
shutup { system "git", "init" }
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin",
|
||||
"https://github.com/someone/homebrew-foo"
|
||||
end
|
||||
@ -148,10 +146,8 @@ describe Tap do
|
||||
services_tap = described_class.new("Homebrew", "services")
|
||||
services_tap.path.mkpath
|
||||
services_tap.path.cd do
|
||||
shutup do
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-services"
|
||||
end
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-services"
|
||||
end
|
||||
expect(services_tap).not_to be_private
|
||||
end
|
||||
@ -217,7 +213,7 @@ describe Tap do
|
||||
tap = described_class.new("user", "repo")
|
||||
|
||||
expect {
|
||||
shutup { tap.install clone_target: "file:///not/existed/remote/url" }
|
||||
tap.install clone_target: "file:///not/existed/remote/url"
|
||||
}.to raise_error(ErrorDuringExecution)
|
||||
|
||||
expect(tap).not_to be_installed
|
||||
@ -238,17 +234,16 @@ describe Tap do
|
||||
setup_git_repo
|
||||
|
||||
tap = Tap.new("Homebrew", "bar")
|
||||
shutup do
|
||||
tap.install clone_target: subject.path/".git"
|
||||
end
|
||||
|
||||
tap.install clone_target: subject.path/".git"
|
||||
|
||||
expect(tap).to be_installed
|
||||
expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").to be_a_file
|
||||
expect(HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").to be_a_file
|
||||
expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").to be_a_file
|
||||
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file
|
||||
shutup do
|
||||
tap.uninstall
|
||||
end
|
||||
tap.uninstall
|
||||
|
||||
expect(tap).not_to be_installed
|
||||
expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").not_to exist
|
||||
expect(HOMEBREW_PREFIX/"share/man/man1").not_to exist
|
||||
@ -266,17 +261,17 @@ describe Tap do
|
||||
setup_tap_files
|
||||
setup_git_repo
|
||||
tap = Tap.new("Homebrew", "baz")
|
||||
shutup { tap.install clone_target: subject.path/".git" }
|
||||
tap.install clone_target: subject.path/".git"
|
||||
(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").delete
|
||||
(HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").delete
|
||||
(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").delete
|
||||
(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").delete
|
||||
shutup { tap.link_completions_and_manpages }
|
||||
tap.link_completions_and_manpages
|
||||
expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").to be_a_file
|
||||
expect(HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").to be_a_file
|
||||
expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").to be_a_file
|
||||
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file
|
||||
shutup { tap.uninstall }
|
||||
tap.uninstall
|
||||
ensure
|
||||
(HOMEBREW_PREFIX/"etc").rmtree if (HOMEBREW_PREFIX/"etc").exist?
|
||||
(HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user