aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/cli
diff options
context:
space:
mode:
authorMarkus Reiter2017-03-16 22:58:21 +0100
committerGitHub2017-03-16 22:58:21 +0100
commitbfb5bf1d7007821c74de4252fe1ade5047e0ca3c (patch)
treefc9991edb93017eaab5fe4b26f781a45ad909b77 /Library/Homebrew/test/cask/cli
parentc4d8b1696c90fa54f0e2f4bce3c734f7a657662b (diff)
parented10135da4fbabca2798afe949b6f5af9544ec9f (diff)
downloadbrew-bfb5bf1d7007821c74de4252fe1ade5047e0ca3c.tar.bz2
Merge pull request #2325 from reitermarkus/better-cask-loading
Use a `Formulary`-like approach to load Casks.
Diffstat (limited to 'Library/Homebrew/test/cask/cli')
-rw-r--r--Library/Homebrew/test/cask/cli/audit_spec.rb10
-rw-r--r--Library/Homebrew/test/cask/cli/create_spec.rb12
-rw-r--r--Library/Homebrew/test/cask/cli/edit_spec.rb4
-rw-r--r--Library/Homebrew/test/cask/cli/list_spec.rb21
-rw-r--r--Library/Homebrew/test/cask/cli/style_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/cli/zap_spec.rb2
6 files changed, 17 insertions, 34 deletions
diff --git a/Library/Homebrew/test/cask/cli/audit_spec.rb b/Library/Homebrew/test/cask/cli/audit_spec.rb
index 2736e60c1..007ba1eb3 100644
--- a/Library/Homebrew/test/cask/cli/audit_spec.rb
+++ b/Library/Homebrew/test/cask/cli/audit_spec.rb
@@ -13,7 +13,7 @@ describe Hbc::CLI::Audit, :cask do
it "audits specified Casks if tokens are given" do
cask_token = "nice-app"
- expect(Hbc).to receive(:load).with(cask_token).and_return(cask)
+ expect(Hbc::CaskLoader).to receive(:load).with(cask_token).and_return(cask)
expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
@@ -23,14 +23,14 @@ describe Hbc::CLI::Audit, :cask do
describe "rules for downloading a Cask" do
it "does not download the Cask per default" do
- allow(Hbc).to receive(:load).and_return(cask)
+ allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
run_audit(["casktoken"], auditor)
end
it "download a Cask if --download flag is set" do
- allow(Hbc).to receive(:load).and_return(cask)
+ allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
expect(auditor).to receive(:audit).with(cask, audit_download: true, check_token_conflicts: false)
run_audit(["casktoken", "--download"], auditor)
@@ -39,14 +39,14 @@ describe Hbc::CLI::Audit, :cask do
describe "rules for checking token conflicts" do
it "does not check for token conflicts per default" do
- allow(Hbc).to receive(:load).and_return(cask)
+ allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
run_audit(["casktoken"], auditor)
end
it "checks for token conflicts if --token-conflicts flag is set" do
- allow(Hbc).to receive(:load).and_return(cask)
+ allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: true)
run_audit(["casktoken", "--token-conflicts"], auditor)
diff --git a/Library/Homebrew/test/cask/cli/create_spec.rb b/Library/Homebrew/test/cask/cli/create_spec.rb
index 21eaeb656..b1cee6990 100644
--- a/Library/Homebrew/test/cask/cli/create_spec.rb
+++ b/Library/Homebrew/test/cask/cli/create_spec.rb
@@ -24,7 +24,7 @@ describe Hbc::CLI::Create, :cask do
after(:each) do
%w[new-cask additional-cask another-cask yet-another-cask local-caff].each do |cask|
- path = Hbc.path(cask)
+ path = Hbc::CaskLoader.path(cask)
path.delete if path.exist?
end
end
@@ -32,13 +32,13 @@ describe Hbc::CLI::Create, :cask do
it "opens the editor for the specified Cask" do
Hbc::CLI::Create.run("new-cask")
expect(Hbc::CLI::Create.editor_commands).to eq [
- [Hbc.path("new-cask")],
+ [Hbc::CaskLoader.path("new-cask")],
]
end
it "drops a template down for the specified Cask" do
Hbc::CLI::Create.run("new-cask")
- template = File.read(Hbc.path("new-cask"))
+ template = File.read(Hbc::CaskLoader.path("new-cask"))
expect(template).to eq <<-EOS.undent
cask 'new-cask' do
version ''
@@ -56,14 +56,14 @@ describe Hbc::CLI::Create, :cask do
it "throws away additional Cask arguments and uses the first" do
Hbc::CLI::Create.run("additional-cask", "another-cask")
expect(Hbc::CLI::Create.editor_commands).to eq [
- [Hbc.path("additional-cask")],
+ [Hbc::CaskLoader.path("additional-cask")],
]
end
it "throws away stray options" do
Hbc::CLI::Create.run("--notavalidoption", "yet-another-cask")
expect(Hbc::CLI::Create.editor_commands).to eq [
- [Hbc.path("yet-another-cask")],
+ [Hbc::CaskLoader.path("yet-another-cask")],
]
end
@@ -76,7 +76,7 @@ describe Hbc::CLI::Create, :cask do
it "allows creating Casks that are substrings of existing Casks" do
Hbc::CLI::Create.run("local-caff")
expect(Hbc::CLI::Create.editor_commands).to eq [
- [Hbc.path("local-caff")],
+ [Hbc::CaskLoader.path("local-caff")],
]
end
diff --git a/Library/Homebrew/test/cask/cli/edit_spec.rb b/Library/Homebrew/test/cask/cli/edit_spec.rb
index 61970290b..f5f98afc8 100644
--- a/Library/Homebrew/test/cask/cli/edit_spec.rb
+++ b/Library/Homebrew/test/cask/cli/edit_spec.rb
@@ -25,14 +25,14 @@ describe Hbc::CLI::Edit, :cask do
it "opens the editor for the specified Cask" do
Hbc::CLI::Edit.run("local-caffeine")
expect(Hbc::CLI::Edit.editor_commands).to eq [
- [Hbc.path("local-caffeine")],
+ [Hbc::CaskLoader.path("local-caffeine")],
]
end
it "throws away additional arguments and uses the first" do
Hbc::CLI::Edit.run("local-caffeine", "local-transmission")
expect(Hbc::CLI::Edit.editor_commands).to eq [
- [Hbc.path("local-caffeine")],
+ [Hbc::CaskLoader.path("local-caffeine")],
]
end
diff --git a/Library/Homebrew/test/cask/cli/list_spec.rb b/Library/Homebrew/test/cask/cli/list_spec.rb
index e367e9588..d3fee7306 100644
--- a/Library/Homebrew/test/cask/cli/list_spec.rb
+++ b/Library/Homebrew/test/cask/cli/list_spec.rb
@@ -1,6 +1,6 @@
describe Hbc::CLI::List, :cask do
it "lists the installed Casks in a pretty fashion" do
- casks = %w[local-caffeine local-transmission].map { |c| Hbc.load(c) }
+ casks = %w[local-caffeine local-transmission].map { |c| Hbc::CaskLoader.load(c) }
casks.each do |c|
InstallHelper.install_with_caskfile(c)
@@ -24,7 +24,7 @@ describe Hbc::CLI::List, :cask do
}
before(:each) do
- casks.map(&Hbc.method(:load)).each(&InstallHelper.method(:install_with_caskfile))
+ casks.map(&Hbc::CaskLoader.method(:load)).each(&InstallHelper.method(:install_with_caskfile))
end
it "of all installed Casks" do
@@ -40,23 +40,6 @@ describe Hbc::CLI::List, :cask do
end
end
- describe "when Casks have been renamed" do
- let(:caskroom_path) { Hbc.caskroom.join("ive-been-renamed") }
- let(:staged_path) { caskroom_path.join("latest") }
-
- before do
- staged_path.mkpath
- end
-
- it "lists installed Casks without backing ruby files (due to renames or otherwise)" do
- expect {
- Hbc::CLI::List.run
- }.to output(<<-EOS.undent).to_stdout
- ive-been-renamed (!)
- EOS
- end
- 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") }
diff --git a/Library/Homebrew/test/cask/cli/style_spec.rb b/Library/Homebrew/test/cask/cli/style_spec.rb
index 3f2ec91e2..ca17c5e46 100644
--- a/Library/Homebrew/test/cask/cli/style_spec.rb
+++ b/Library/Homebrew/test/cask/cli/style_spec.rb
@@ -130,7 +130,7 @@ describe Hbc::CLI::Style, :cask do
end
it "tries to find paths for all tokens" do
- expect(Hbc).to receive(:path).twice
+ expect(Hbc::CaskLoader).to receive(:path).twice
subject
end
end
diff --git a/Library/Homebrew/test/cask/cli/zap_spec.rb b/Library/Homebrew/test/cask/cli/zap_spec.rb
index 0f3d024b5..58992deb5 100644
--- a/Library/Homebrew/test/cask/cli/zap_spec.rb
+++ b/Library/Homebrew/test/cask/cli/zap_spec.rb
@@ -32,7 +32,7 @@ describe Hbc::CLI::Zap, :cask do
# The above tests that implicitly.
#
# it "dispatches both uninstall and zap stanzas" do
- # with_zap = Hbc.load('with-zap')
+ # with_zap = Hbc::CaskLoader.load('with-zap')
#
# shutup do
# Hbc::Installer.new(with_zap).install