diff options
Diffstat (limited to 'Library/Homebrew/test/cask/cli')
| -rw-r--r-- | Library/Homebrew/test/cask/cli/fetch_spec.rb | 24 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/install_spec.rb | 28 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/list_spec.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/outdated_spec.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/reinstall_spec.rb | 17 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/search_spec.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/style_spec.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/uninstall_spec.rb | 48 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/zap_spec.rb | 19 |
9 files changed, 42 insertions, 111 deletions
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 |
