diff options
Diffstat (limited to 'Library/Homebrew')
74 files changed, 361 insertions, 795 deletions
diff --git a/Library/Homebrew/test/cask/accessibility_spec.rb b/Library/Homebrew/test/cask/accessibility_spec.rb index 4ac757e69..9e56f6bd3 100644 --- a/Library/Homebrew/test/cask/accessibility_spec.rb +++ b/Library/Homebrew/test/cask/accessibility_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb index 9bcdd27a1..9e8d83bb4 100644 --- a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb +++ b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb index 54e6ae5bf..0add472e2 100644 --- a/Library/Homebrew/test/cask/artifact/app_spec.rb +++ b/Library/Homebrew/test/cask/artifact/app_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb index f9b5f5b42..ce00e3935 100644 --- a/Library/Homebrew/test/cask/artifact/binary_spec.rb +++ b/Library/Homebrew/test/cask/artifact/binary_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb index b383e2d4e..cb2ef9850 100644 --- a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb +++ b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/nested_container_spec.rb b/Library/Homebrew/test/cask/artifact/nested_container_spec.rb index 3e9a549ea..be7ba5ff8 100644 --- a/Library/Homebrew/test/cask/artifact/nested_container_spec.rb +++ b/Library/Homebrew/test/cask/artifact/nested_container_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/pkg_spec.rb b/Library/Homebrew/test/cask/artifact/pkg_spec.rb index 249439900..3e62616ea 100644 --- a/Library/Homebrew/test/cask/artifact/pkg_spec.rb +++ b/Library/Homebrew/test/cask/artifact/pkg_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/suite_spec.rb b/Library/Homebrew/test/cask/artifact/suite_spec.rb index eca6b6f17..8c217a9e0 100644 --- a/Library/Homebrew/test/cask/artifact/suite_spec.rb +++ b/Library/Homebrew/test/cask/artifact/suite_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb index 9db22b2a3..a1fdd3b74 100644 --- a/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb +++ b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb b/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb index f88aaa49d..8cd0b1e41 100644 --- a/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb +++ b/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb index b84c1fd00..0e522bc21 100644 --- a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb +++ b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb @@ -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") } diff --git a/Library/Homebrew/test/cask/cask_spec.rb b/Library/Homebrew/test/cask/cask_spec.rb index 3736f3c01..a6ecc207f 100644 --- a/Library/Homebrew/test/cask/cask_spec.rb +++ b/Library/Homebrew/test/cask/cask_spec.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 diff --git a/Library/Homebrew/test/cask/cli/fetch_spec.rb b/Library/Homebrew/test/cask/cli/fetch_spec.rb index 54bdfc0c8..f71c23fb6 100644 --- a/Library/Homebrew/test/cask/cli/fetch_spec.rb +++ b/Library/Homebrew/test/cask/cli/fetch_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb index cf69b5d86..64feacce9 100644 --- a/Library/Homebrew/test/cask/cli/install_spec.rb +++ b/Library/Homebrew/test/cask/cli/install_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/cli/list_spec.rb b/Library/Homebrew/test/cask/cli/list_spec.rb index d3fee7306..ecca3035f 100644 --- a/Library/Homebrew/test/cask/cli/list_spec.rb +++ b/Library/Homebrew/test/cask/cli/list_spec.rb @@ -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") diff --git a/Library/Homebrew/test/cask/cli/outdated_spec.rb b/Library/Homebrew/test/cask/cli/outdated_spec.rb index 3d9e9bdeb..946092f89 100644 --- a/Library/Homebrew/test/cask/cli/outdated_spec.rb +++ b/Library/Homebrew/test/cask/cli/outdated_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/cli/reinstall_spec.rb b/Library/Homebrew/test/cask/cli/reinstall_spec.rb index 8885fa199..3a9c3e2f5 100644 --- a/Library/Homebrew/test/cask/cli/reinstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/reinstall_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/cli/search_spec.rb b/Library/Homebrew/test/cask/cli/search_spec.rb index f43610767..e237ad464 100644 --- a/Library/Homebrew/test/cask/cli/search_spec.rb +++ b/Library/Homebrew/test/cask/cli/search_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/cli/style_spec.rb b/Library/Homebrew/test/cask/cli/style_spec.rb index 15507f410..2007b87d7 100644 --- a/Library/Homebrew/test/cask/cli/style_spec.rb +++ b/Library/Homebrew/test/cask/cli/style_spec.rb @@ -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 } diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb index cc640fad7..1a1c57e88 100644 --- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/cli/zap_spec.rb b/Library/Homebrew/test/cask/cli/zap_spec.rb index e39ca61f8..fdc5b4125 100644 --- a/Library/Homebrew/test/cask/cli/zap_spec.rb +++ b/Library/Homebrew/test/cask/cli/zap_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb index 51258c580..4a61e0088 100644 --- a/Library/Homebrew/test/cask/cli_spec.rb +++ b/Library/Homebrew/test/cask/cli_spec.rb @@ -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) diff --git a/Library/Homebrew/test/cask/container/naked_spec.rb b/Library/Homebrew/test/cask/container/naked_spec.rb index eb30ef81a..1ccdf4ef4 100644 --- a/Library/Homebrew/test/cask/container/naked_spec.rb +++ b/Library/Homebrew/test/cask/container/naked_spec.rb @@ -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) diff --git a/Library/Homebrew/test/cask/depends_on_spec.rb b/Library/Homebrew/test/cask/depends_on_spec.rb index 4b78820ce..c603cf6e1 100644 --- a/Library/Homebrew/test/cask/depends_on_spec.rb +++ b/Library/Homebrew/test/cask/depends_on_spec.rb @@ -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 } diff --git a/Library/Homebrew/test/cask/download_strategy_spec.rb b/Library/Homebrew/test/cask/download_strategy_spec.rb index 27f1ad410..222352c07 100644 --- a/Library/Homebrew/test/cask/download_strategy_spec.rb +++ b/Library/Homebrew/test/cask/download_strategy_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 5849f581b..7f2207a87 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/installer_spec.rb b/Library/Homebrew/test/cask/installer_spec.rb index b5a445aec..6f7c6d3d7 100644 --- a/Library/Homebrew/test/cask/installer_spec.rb +++ b/Library/Homebrew/test/cask/installer_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/pkg_spec.rb b/Library/Homebrew/test/cask/pkg_spec.rb index e507ceda0..56061c9fd 100644 --- a/Library/Homebrew/test/cask/pkg_spec.rb +++ b/Library/Homebrew/test/cask/pkg_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/staged_spec.rb b/Library/Homebrew/test/cask/staged_spec.rb index 670775b7a..73a909f35 100644 --- a/Library/Homebrew/test/cask/staged_spec.rb +++ b/Library/Homebrew/test/cask/staged_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/system_command_spec.rb b/Library/Homebrew/test/cask/system_command_spec.rb index 8d1180bea..ba5ea03fc 100644 --- a/Library/Homebrew/test/cask/system_command_spec.rb +++ b/Library/Homebrew/test/cask/system_command_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/verify/checksum_spec.rb b/Library/Homebrew/test/cask/verify/checksum_spec.rb index 4b8543d2b..117b9089d 100644 --- a/Library/Homebrew/test/cask/verify/checksum_spec.rb +++ b/Library/Homebrew/test/cask/verify/checksum_spec.rb @@ -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) } diff --git a/Library/Homebrew/test/checksum_verification_spec.rb b/Library/Homebrew/test/checksum_verification_spec.rb index f749f2792..247f08688 100644 --- a/Library/Homebrew/test/checksum_verification_spec.rb +++ b/Library/Homebrew/test/checksum_verification_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cleanup_spec.rb b/Library/Homebrew/test/cleanup_spec.rb index 2c3eddb8c..4e5e42efa 100644 --- a/Library/Homebrew/test/cleanup_spec.rb +++ b/Library/Homebrew/test/cleanup_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/analytics_spec.rb b/Library/Homebrew/test/cmd/analytics_spec.rb index aed3a7a33..f29c2bb7f 100644 --- a/Library/Homebrew/test/cmd/analytics_spec.rb +++ b/Library/Homebrew/test/cmd/analytics_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/bundle_spec.rb b/Library/Homebrew/test/cmd/bundle_spec.rb index 286ddba97..c2434254e 100644 --- a/Library/Homebrew/test/cmd/bundle_spec.rb +++ b/Library/Homebrew/test/cmd/bundle_spec.rb @@ -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| diff --git a/Library/Homebrew/test/cmd/cask_spec.rb b/Library/Homebrew/test/cmd/cask_spec.rb index 3bba5fbf4..aa34f50e8 100644 --- a/Library/Homebrew/test/cmd/cask_spec.rb +++ b/Library/Homebrew/test/cmd/cask_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/desc_spec.rb b/Library/Homebrew/test/cmd/desc_spec.rb index b09819d81..97fe929c9 100644 --- a/Library/Homebrew/test/cmd/desc_spec.rb +++ b/Library/Homebrew/test/cmd/desc_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/fetch_spec.rb b/Library/Homebrew/test/cmd/fetch_spec.rb index 111d9f85c..9e8d0bbf4 100644 --- a/Library/Homebrew/test/cmd/fetch_spec.rb +++ b/Library/Homebrew/test/cmd/fetch_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/install_spec.rb b/Library/Homebrew/test/cmd/install_spec.rb index 6fff44131..b6030f26a 100644 --- a/Library/Homebrew/test/cmd/install_spec.rb +++ b/Library/Homebrew/test/cmd/install_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/link_spec.rb b/Library/Homebrew/test/cmd/link_spec.rb index 59ab86cc4..78942b7a8 100644 --- a/Library/Homebrew/test/cmd/link_spec.rb +++ b/Library/Homebrew/test/cmd/link_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/log_spec.rb b/Library/Homebrew/test/cmd/log_spec.rb index b9e3e8d3e..26b59816c 100644 --- a/Library/Homebrew/test/cmd/log_spec.rb +++ b/Library/Homebrew/test/cmd/log_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/outdated_spec.rb b/Library/Homebrew/test/cmd/outdated_spec.rb index 65cce27c3..8b4c01e53 100644 --- a/Library/Homebrew/test/cmd/outdated_spec.rb +++ b/Library/Homebrew/test/cmd/outdated_spec.rb @@ -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 = [ { diff --git a/Library/Homebrew/test/cmd/pin_spec.rb b/Library/Homebrew/test/cmd/pin_spec.rb index 9ffc052c3..a8f680d71 100644 --- a/Library/Homebrew/test/cmd/pin_spec.rb +++ b/Library/Homebrew/test/cmd/pin_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/reinstall_spec.rb b/Library/Homebrew/test/cmd/reinstall_spec.rb index 63584e6be..f5794049d 100644 --- a/Library/Homebrew/test/cmd/reinstall_spec.rb +++ b/Library/Homebrew/test/cmd/reinstall_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/switch_spec.rb b/Library/Homebrew/test/cmd/switch_spec.rb index c27c96c14..00fe4ace6 100644 --- a/Library/Homebrew/test/cmd/switch_spec.rb +++ b/Library/Homebrew/test/cmd/switch_spec.rb @@ -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" diff --git a/Library/Homebrew/test/cmd/uninstall_spec.rb b/Library/Homebrew/test/cmd/uninstall_spec.rb index b9a0d8d40..27ab0e1f7 100644 --- a/Library/Homebrew/test/cmd/uninstall_spec.rb +++ b/Library/Homebrew/test/cmd/uninstall_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/unlink_spec.rb b/Library/Homebrew/test/cmd/unlink_spec.rb index 5961651fe..1fd242506 100644 --- a/Library/Homebrew/test/cmd/unlink_spec.rb +++ b/Library/Homebrew/test/cmd/unlink_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/unpack_spec.rb b/Library/Homebrew/test/cmd/unpack_spec.rb index 9b2b801bc..8bfe15c9f 100644 --- a/Library/Homebrew/test/cmd/unpack_spec.rb +++ b/Library/Homebrew/test/cmd/unpack_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/unpin_spec.rb b/Library/Homebrew/test/cmd/unpin_spec.rb index 4f14626d8..29d5f0c8a 100644 --- a/Library/Homebrew/test/cmd/unpin_spec.rb +++ b/Library/Homebrew/test/cmd/unpin_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/upgrade_spec.rb b/Library/Homebrew/test/cmd/upgrade_spec.rb index 84f5c09f4..10d5386a1 100644 --- a/Library/Homebrew/test/cmd/upgrade_spec.rb +++ b/Library/Homebrew/test/cmd/upgrade_spec.rb @@ -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 diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 25a179342..f2d8a8e7c 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -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 diff --git a/Library/Homebrew/test/dev-cmd/bottle_spec.rb b/Library/Homebrew/test/dev-cmd/bottle_spec.rb index 468ef2e90..1cc72f95a 100644 --- a/Library/Homebrew/test/dev-cmd/bottle_spec.rb +++ b/Library/Homebrew/test/dev-cmd/bottle_spec.rb @@ -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 diff --git a/Library/Homebrew/test/dev-cmd/create_spec.rb b/Library/Homebrew/test/dev-cmd/create_spec.rb index b7f96ec7f..7c85a9f7d 100644 --- a/Library/Homebrew/test/dev-cmd/create_spec.rb +++ b/Library/Homebrew/test/dev-cmd/create_spec.rb @@ -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}")) diff --git a/Library/Homebrew/test/dev-cmd/edit_spec.rb b/Library/Homebrew/test/dev-cmd/edit_spec.rb index 5cedb0524..3f557fcdf 100644 --- a/Library/Homebrew/test/dev-cmd/edit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/edit_spec.rb @@ -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" diff --git a/Library/Homebrew/test/dev-cmd/pull_spec.rb b/Library/Homebrew/test/dev-cmd/pull_spec.rb index 9037342b8..9815ef9a1 100644 --- a/Library/Homebrew/test/dev-cmd/pull_spec.rb +++ b/Library/Homebrew/test/dev-cmd/pull_spec.rb @@ -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/" } diff --git a/Library/Homebrew/test/dev-cmd/tap_spec.rb b/Library/Homebrew/test/dev-cmd/tap_spec.rb index a24c67aae..93e9c0ed6 100644 --- a/Library/Homebrew/test/dev-cmd/tap_spec.rb +++ b/Library/Homebrew/test/dev-cmd/tap_spec.rb @@ -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" } diff --git a/Library/Homebrew/test/dev-cmd/test_spec.rb b/Library/Homebrew/test/dev-cmd/test_spec.rb index b73d042e4..9ff365bfb 100644 --- a/Library/Homebrew/test/dev-cmd/test_spec.rb +++ b/Library/Homebrew/test/dev-cmd/test_spec.rb @@ -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 diff --git a/Library/Homebrew/test/download_strategies_spec.rb b/Library/Homebrew/test/download_strategies_spec.rb index f466b97f4..8c376a649 100644 --- a/Library/Homebrew/test/download_strategies_spec.rb +++ b/Library/Homebrew/test/download_strategies_spec.rb @@ -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 diff --git a/Library/Homebrew/test/formula_installer_bottle_spec.rb b/Library/Homebrew/test/formula_installer_bottle_spec.rb index 824cdb36d..6d9e27daa 100644 --- a/Library/Homebrew/test/formula_installer_bottle_spec.rb +++ b/Library/Homebrew/test/formula_installer_bottle_spec.rb @@ -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) diff --git a/Library/Homebrew/test/formula_installer_spec.rb b/Library/Homebrew/test/formula_installer_spec.rb index d309a17da..49bb5d564 100644 --- a/Library/Homebrew/test/formula_installer_spec.rb +++ b/Library/Homebrew/test/formula_installer_spec.rb @@ -18,9 +18,7 @@ describe FormulaInstaller do installer = described_class.new(formula) - shutup do - installer.install - end + installer.install keg = Keg.new(formula.prefix) diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 364dbfe98..6ba6af307 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -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 diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index 213ad511d..234ebc93c 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -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 diff --git a/Library/Homebrew/test/language/go_spec.rb b/Library/Homebrew/test/language/go_spec.rb index fb8c97829..1625b7f78 100644 --- a/Library/Homebrew/test/language/go_spec.rb +++ b/Library/Homebrew/test/language/go_spec.rb @@ -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 diff --git a/Library/Homebrew/test/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb index 900c10c02..490e413f5 100644 --- a/Library/Homebrew/test/migrator_spec.rb +++ b/Library/Homebrew/test/migrator_spec.rb @@ -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 diff --git a/Library/Homebrew/test/missing_formula_spec.rb b/Library/Homebrew/test/missing_formula_spec.rb index 69bb3e70d..a48f12ecd 100644 --- a/Library/Homebrew/test/missing_formula_spec.rb +++ b/Library/Homebrew/test/missing_formula_spec.rb @@ -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 diff --git a/Library/Homebrew/test/patching_spec.rb b/Library/Homebrew/test/patching_spec.rb index dd849ca92..502f6204c 100644 --- a/Library/Homebrew/test/patching_spec.rb +++ b/Library/Homebrew/test/patching_spec.rb @@ -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 diff --git a/Library/Homebrew/test/resource_spec.rb b/Library/Homebrew/test/resource_spec.rb index 6a0419538..7eef3268d 100644 --- a/Library/Homebrew/test/resource_spec.rb +++ b/Library/Homebrew/test/resource_spec.rb @@ -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 diff --git a/Library/Homebrew/test/sandbox_spec.rb b/Library/Homebrew/test/sandbox_spec.rb index eafec4dd4..10414f75b 100644 --- a/Library/Homebrew/test/sandbox_spec.rb +++ b/Library/Homebrew/test/sandbox_spec.rb @@ -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 diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 222f85fc4..a4ac84547 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -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 [ diff --git a/Library/Homebrew/test/support/helper/cask/install_helper.rb b/Library/Homebrew/test/support/helper/cask/install_helper.rb index d91b9ea57..1205512bf 100644 --- a/Library/Homebrew/test/support/helper/cask/install_helper.rb +++ b/Library/Homebrew/test/support/helper/cask/install_helper.rb @@ -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 diff --git a/Library/Homebrew/test/support/helper/shutup.rb b/Library/Homebrew/test/support/helper/shutup.rb deleted file mode 100644 index fa5f08d31..000000000 --- a/Library/Homebrew/test/support/helper/shutup.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index cf9c13fb8..7bf2ce96a 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -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 diff --git a/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb index 1364c13a3..361179b9e 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb @@ -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 diff --git a/Library/Homebrew/test/tap_spec.rb b/Library/Homebrew/test/tap_spec.rb index 27b5e0c4b..0eb4ca1be 100644 --- a/Library/Homebrew/test/tap_spec.rb +++ b/Library/Homebrew/test/tap_spec.rb @@ -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? |
