diff options
| author | Markus Reiter | 2017-10-07 18:30:32 +0200 | 
|---|---|---|
| committer | GitHub | 2017-10-07 18:30:32 +0200 | 
| commit | 5cbf8bdaa7ff080948618d7f3f62f8be2f72ef97 (patch) | |
| tree | fd6b201daffdf3cc204a0f2d53dd61dfd53e7845 /Library/Homebrew/test/cask/cli | |
| parent | 62315e93f8b1308fc39bdea3d9dfe36db6e5bede (diff) | |
| parent | 97333df4cb4bd006401193639400a8bc6df56e3a (diff) | |
| download | brew-5cbf8bdaa7ff080948618d7f3f62f8be2f72ef97.tar.bz2 | |
Merge pull request #3283 from reitermarkus/cask-loader
Add helper method for Cask fixture paths and refactor CaskLoader.
Diffstat (limited to 'Library/Homebrew/test/cask/cli')
| -rw-r--r-- | Library/Homebrew/test/cask/cli/fetch_spec.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/install_spec.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/list_spec.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/outdated_spec.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/reinstall_spec.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/uninstall_spec.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/zap_spec.rb | 4 | 
7 files changed, 28 insertions, 28 deletions
diff --git a/Library/Homebrew/test/cask/cli/fetch_spec.rb b/Library/Homebrew/test/cask/cli/fetch_spec.rb index 087a30f50..67cf6e61d 100644 --- a/Library/Homebrew/test/cask/cli/fetch_spec.rb +++ b/Library/Homebrew/test/cask/cli/fetch_spec.rb @@ -3,11 +3,11 @@ require_relative "shared_examples/invalid_option"  describe Hbc::CLI::Fetch, :cask do    let(:local_transmission) { -    Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") +    Hbc::CaskLoader.load(cask_path("local-transmission"))    }    let(:local_caffeine) { -    Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") +    Hbc::CaskLoader.load(cask_path("local-caffeine"))    }    it_behaves_like "a command that requires a Cask token" diff --git a/Library/Homebrew/test/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb index 17a7b9f99..c918a3529 100644 --- a/Library/Homebrew/test/cask/cli/install_spec.rb +++ b/Library/Homebrew/test/cask/cli/install_spec.rb @@ -22,16 +22,16 @@ describe Hbc::CLI::Install, :cask do    it "allows staging and activation of multiple Casks at once" do      described_class.run("local-transmission", "local-caffeine") -    expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed      expect(Hbc.appdir.join("Transmission.app")).to be_a_directory -    expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")).to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-caffeine"))).to be_installed      expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory    end    it "skips double install (without nuking existing installation)" do      described_class.run("local-transmission")      described_class.run("local-transmission") -    expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed    end    it "prints a warning message on double install" do @@ -54,9 +54,9 @@ describe Hbc::CLI::Install, :cask do    it "skips dependencies with --skip-cask-deps" do      described_class.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 +    expect(Hbc::CaskLoader.load(cask_path("with-depends-on-cask-multiple"))).to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-caffeine"))).not_to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed    end    it "properly handles Casks that are not present" do diff --git a/Library/Homebrew/test/cask/cli/list_spec.rb b/Library/Homebrew/test/cask/cli/list_spec.rb index 6a92289aa..301ca9b89 100644 --- a/Library/Homebrew/test/cask/cli/list_spec.rb +++ b/Library/Homebrew/test/cask/cli/list_spec.rb @@ -65,8 +65,8 @@ describe Hbc::CLI::List, :cask do    end    describe "given a set of installed Casks" do -    let(:caffeine) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") } -    let(:transmission) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") } +    let(:caffeine) { Hbc::CaskLoader.load(cask_path("local-caffeine")) } +    let(:transmission) { Hbc::CaskLoader.load(cask_path("local-transmission")) }      let(:casks) { [caffeine, transmission] }      it "lists the installed files for those Casks" do diff --git a/Library/Homebrew/test/cask/cli/outdated_spec.rb b/Library/Homebrew/test/cask/cli/outdated_spec.rb index 7fca8c248..5bbf18d21 100644 --- a/Library/Homebrew/test/cask/cli/outdated_spec.rb +++ b/Library/Homebrew/test/cask/cli/outdated_spec.rb @@ -3,11 +3,11 @@ require_relative "shared_examples/invalid_option"  describe Hbc::CLI::Outdated, :cask do    let(:installed) do      [ -      Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb"), -      Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/outdated/local-caffeine.rb"), -      Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/outdated/local-transmission.rb"), -      Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/version-latest-string.rb"), -      Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/outdated/auto-updates.rb"), +      Hbc::CaskLoader.load(cask_path("basic-cask")), +      Hbc::CaskLoader.load(cask_path("outdated/local-caffeine")), +      Hbc::CaskLoader.load(cask_path("outdated/local-transmission")), +      Hbc::CaskLoader.load(cask_path("version-latest-string")), +      Hbc::CaskLoader.load(cask_path("outdated/auto-updates")),      ]    end @@ -74,7 +74,7 @@ describe Hbc::CLI::Outdated, :cask do      end      it 'does not include the Casks with "auto_updates true" when the version did not change' do -      cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb") +      cask = Hbc::CaskLoader.load(cask_path("auto-updates"))        InstallHelper.install_with_caskfile(cask)        expect { diff --git a/Library/Homebrew/test/cask/cli/reinstall_spec.rb b/Library/Homebrew/test/cask/cli/reinstall_spec.rb index 073fbb23c..95294b695 100644 --- a/Library/Homebrew/test/cask/cli/reinstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/reinstall_spec.rb @@ -4,7 +4,7 @@ describe Hbc::CLI::Reinstall, :cask do    it_behaves_like "a command that handles invalid options"    it "displays the reinstallation progress" do -    caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") +    caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))      Hbc::Installer.new(caffeine).install @@ -27,16 +27,16 @@ describe Hbc::CLI::Reinstall, :cask do    it "allows reinstalling a Cask" do      Hbc::CLI::Install.run("local-transmission") -    expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed      Hbc::CLI::Reinstall.run("local-transmission") -    expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).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 +    expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed      Hbc::CLI::Reinstall.run("local-transmission") -    expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed +    expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed    end  end diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb index 9ebd80dfb..80b7edbd3 100644 --- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb @@ -6,7 +6,7 @@ describe Hbc::CLI::Uninstall, :cask do    it_behaves_like "a command that handles invalid options"    it "displays the uninstallation progress" do -    caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") +    caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))      Hbc::Installer.new(caffeine).install @@ -37,8 +37,8 @@ describe Hbc::CLI::Uninstall, :cask do    end    it "can uninstall and unlink multiple Casks at once" 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") +    caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine")) +    transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))      Hbc::Installer.new(caffeine).install      Hbc::Installer.new(transmission).install @@ -55,7 +55,7 @@ describe Hbc::CLI::Uninstall, :cask do    end    it "calls `uninstall` before removing artifacts" do -    cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb") +    cask = Hbc::CaskLoader.load(cask_path("with-uninstall-script-app"))      Hbc::Installer.new(cask).install @@ -71,7 +71,7 @@ describe Hbc::CLI::Uninstall, :cask do    end    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") +    cask = Hbc::CaskLoader.load(cask_path("with-uninstall-script-app"))      Hbc::Installer.new(cask).install diff --git a/Library/Homebrew/test/cask/cli/zap_spec.rb b/Library/Homebrew/test/cask/cli/zap_spec.rb index 19e8ff261..05c882854 100644 --- a/Library/Homebrew/test/cask/cli/zap_spec.rb +++ b/Library/Homebrew/test/cask/cli/zap_spec.rb @@ -11,8 +11,8 @@ describe Hbc::CLI::Zap, :cask do    end    it "can zap and unlink multiple Casks at once" 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") +    caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine")) +    transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))      Hbc::Installer.new(caffeine).install      Hbc::Installer.new(transmission).install  | 
