Add :cask to all Cask specs.

This commit is contained in:
Markus Reiter 2017-03-05 19:26:56 +01:00
parent 43bfaa19f1
commit 73cbb9df3b
53 changed files with 54 additions and 133 deletions

View File

@ -1,8 +1,6 @@
require "spec_helper"
# TODO: this test should be named after the corresponding class, once
# that class is abstracted from installer.rb.
describe "Accessibility Access" do
describe "Accessibility Access", :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-accessibility-access.rb") }
let(:fake_system_command) { class_double(Hbc::SystemCommand) }
let(:installer) { Hbc::Installer.new(cask, command: fake_system_command) }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::App do
describe Hbc::Artifact::App, :cask do
describe "activate to alternate target" do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-alt-target.rb") }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::App do
describe Hbc::Artifact::App, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") }
let(:command) { Hbc::SystemCommand }
let(:force) { false }

View File

@ -1,4 +1,4 @@
describe Hbc::Artifact::Binary do
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

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::Artifact do
describe Hbc::Artifact::Artifact, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact.rb") }
let(:install_phase) {

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::NestedContainer do
describe Hbc::Artifact::NestedContainer, :cask do
describe "install" do
it "extracts the specified paths as containers" do
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb").tap do |c|

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::Pkg do
describe Hbc::Artifact::Pkg, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
let(:fake_system_command) { class_double(Hbc::SystemCommand) }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::PostflightBlock do
describe Hbc::Artifact::PostflightBlock, :cask do
describe "install_phase" do
it "calls the specified block after installing, passing a Cask mini-dsl" do
called = false

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::PreflightBlock do
describe Hbc::Artifact::PreflightBlock, :cask do
describe "install_phase" do
it "calls the specified block before installing, passing a Cask mini-dsl" do
called = false

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::Suite do
describe Hbc::Artifact::Suite, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-suite.rb") }
let(:install_phase) { -> { Hbc::Artifact::Suite.new(cask).install_phase } }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::App do
describe Hbc::Artifact::App, :cask do
describe "multiple apps" do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-correct.rb") }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::App do
describe Hbc::Artifact::App, :cask do
# FIXME: Doesn't actually raise because the `app` stanza is not evaluated on load.
# it "must raise" do
# lambda {

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::Zap do
describe Hbc::Artifact::Zap, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
let(:zap_artifact) {

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Artifact::Uninstall do
describe Hbc::Artifact::Uninstall, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
let(:uninstall_artifact) {

View File

@ -1,7 +1,5 @@
require "spec_helper"
# TODO: test that zap removes an alternate version of the same Cask
describe Hbc::Artifact::Zap do
describe Hbc::Artifact::Zap, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
let(:zap_artifact) {

View File

@ -1,4 +1,4 @@
describe Hbc::Audit do
describe Hbc::Audit, :cask do
def include_msg?(messages, msg)
if msg.is_a?(Regexp)
Array(messages).any? { |m| m =~ msg }

View File

@ -1,4 +1,4 @@
describe Hbc::Cask do
describe Hbc::Cask, :cask do
let(:cask) { described_class.new("versioned-cask") }
context "when multiple versions are installed" do

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Audit do
describe Hbc::CLI::Audit, :cask do
let(:auditor) { double }
let(:cask) { double }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Cat do
describe Hbc::CLI::Cat, :cask do
describe "given a basic Cask" do
let(:expected_output) {
<<-EOS.undent

View File

@ -1,4 +1,4 @@
describe Hbc::CLI::Cleanup do
describe Hbc::CLI::Cleanup, :cask do
let(:cache_location) { Pathname.new(Dir.mktmpdir).realpath }
let(:cleanup_outdated) { false }

View File

@ -1,5 +1,3 @@
require "spec_helper"
# monkeypatch for testing
module Hbc
class CLI
@ -19,7 +17,7 @@ module Hbc
end
end
describe Hbc::CLI::Create do
describe Hbc::CLI::Create, :cask do
before(:each) do
Hbc::CLI::Create.reset!
end

View File

@ -1,5 +1,3 @@
require "spec_helper"
# monkeypatch for testing
module Hbc
class CLI
@ -19,7 +17,7 @@ module Hbc
end
end
describe Hbc::CLI::Edit do
describe Hbc::CLI::Edit, :cask do
before(:each) do
Hbc::CLI::Edit.reset!
end

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Fetch do
describe Hbc::CLI::Fetch, :cask do
let(:local_transmission) {
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
}

View File

@ -1,5 +1,3 @@
require "spec_helper"
# monkeypatch for testing
module Hbc
class CLI
@ -19,7 +17,7 @@ module Hbc
end
end
describe Hbc::CLI::Home do
describe Hbc::CLI::Home, :cask do
before do
Hbc::CLI::Home.reset!
end

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Info do
describe Hbc::CLI::Info, :cask do
it "displays some nice info about the specified Cask" do
expect {
Hbc::CLI::Info.run("local-caffeine")

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Install do
describe Hbc::CLI::Install, :cask do
it "allows staging and activation of multiple Casks at once" do
shutup do
Hbc::CLI::Install.run("local-transmission", "local-caffeine")

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::List do
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) }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI do
describe Hbc::CLI, :cask do
it "supports setting the appdir" do
Hbc::CLI.process_options %w[help --appdir=/some/path/foo]

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Reinstall do
describe Hbc::CLI::Reinstall, :cask do
it "allows reinstalling a Cask" do
shutup do
Hbc::CLI::Install.run("local-transmission")

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Search do
describe Hbc::CLI::Search, :cask do
it "lists the available Casks that match the search term" do
expect {
Hbc::CLI::Search.run("local")

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Uninstall do
describe Hbc::CLI::Uninstall, :cask do
it "shows an error when a bad Cask is provided" do
expect {
Hbc::CLI::Uninstall.run("notacask")

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe "brew cask --version" do
describe "brew cask --version", :cask do
it "respects the --version argument" do
expect {
expect {

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::CLI::Zap do
describe Hbc::CLI::Zap, :cask do
it "shows an error when a bad Cask is provided" do
expect {
Hbc::CLI::Zap.run("notacask")

View File

@ -1,4 +1,4 @@
describe Hbc::CLI do
describe Hbc::CLI, :cask do
it "lists the taps for Casks that show up in two taps" do
listing = Hbc::CLI.nice_listing(%w[
caskroom/cask/adium

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Container::Dmg do
describe Hbc::Container::Dmg, :cask do
describe "#mount!" do
it "does not store nil mounts for dmgs with extra data" do
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Container::Naked do
describe Hbc::Container::Naked, :cask do
it "saves files with spaces in them from uris with encoded spaces" do
cask = Hbc::Cask.new("spacey") do
url "http://example.com/kevin%20spacey.pkg"

View File

@ -1,8 +1,6 @@
require "spec_helper"
# TODO: this test should be named after the corresponding class, once
# that class is abstracted from installer.rb
describe "Satisfy Dependencies and Requirements" do
describe "Satisfy Dependencies and Requirements", :cask do
subject {
lambda do
shutup do

View File

@ -1,4 +1,4 @@
describe "download strategies" do
describe "download strategies", :cask do
let(:url) { "http://example.com/cask.dmg" }
let(:url_options) { Hash.new }
let(:cask) {

View File

@ -1,7 +1,6 @@
require "spec_helper"
require "test/support/helper/spec/shared_examples/hbc_dsl_base"
describe Hbc::DSL::Caveats do
describe Hbc::DSL::Caveats, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::Caveats.new(cask) }

View File

@ -1,8 +1,7 @@
require "spec_helper"
require "test/support/helper/spec/shared_examples/hbc_dsl_base"
require "test/support/helper/spec/shared_examples/hbc_staged"
describe Hbc::DSL::Postflight do
describe Hbc::DSL::Postflight, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::Postflight.new(cask, Hbc::FakeSystemCommand) }

View File

@ -1,8 +1,7 @@
require "spec_helper"
require "test/support/helper/spec/shared_examples/hbc_dsl_base"
require "test/support/helper/spec/shared_examples/hbc_staged"
describe Hbc::DSL::Preflight do
describe Hbc::DSL::Preflight, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::Preflight.new(cask, Hbc::FakeSystemCommand) }

View File

@ -1,7 +1,6 @@
require "spec_helper"
require "test/support/helper/spec/shared_examples/hbc_dsl_base"
describe Hbc::DSL::UninstallPostflight do
describe Hbc::DSL::UninstallPostflight, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::UninstallPostflight.new(cask, Hbc::FakeSystemCommand) }

View File

@ -1,8 +1,7 @@
require "spec_helper"
require "test/support/helper/spec/shared_examples/hbc_dsl_base"
require "test/support/helper/spec/shared_examples/hbc_staged"
describe Hbc::DSL::UninstallPreflight do
describe Hbc::DSL::UninstallPreflight, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::UninstallPreflight.new(cask, Hbc::FakeSystemCommand) }

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::DSL do
describe Hbc::DSL, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/#{token}.rb") }
let(:token) { "basic-cask" }
@ -76,7 +74,7 @@ describe Hbc::DSL do
end
end
context "when it contains a deprecated DSL version" do
context "when it contains a deprecated DSL version", :needs_compat do
let(:token) { "with-dsl-version" }
it "may use deprecated DSL version hash syntax" do

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Installer do
describe Hbc::Installer, :cask do
describe "install" do
let(:empty_depends_on_stub) {
double(formula: [], cask: [], macos: nil, arch: nil, x11: nil)

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::Pkg do
describe Hbc::Pkg, :cask do
describe "uninstall" do
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
let(:empty_response) { double(stdout: "") }

View File

@ -1,4 +1,4 @@
describe Hbc::Scopes do
describe Hbc::Scopes, :cask do
describe "installed" do
it "returns a list installed Casks by loading Casks for all the dirs that exist in the caskroom" do
allow(Hbc).to receive(:load) { |token| "loaded-#{token}" }

View File

@ -1,9 +1,7 @@
require "spec_helper"
# TODO: this test should be named after the corresponding class, once
# that class is abstracted from installer.rb. It makes little sense
# to be invoking bundle_identifier off of the installer instance.
describe "Operations on staged Casks" do
describe "Operations on staged Casks", :cask do
describe "bundle ID" do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") }
let(:installer) { Hbc::Installer.new(cask) }

View File

@ -1,6 +1,6 @@
require "hbc/system_command"
describe Hbc::SystemCommand::Result do
describe Hbc::SystemCommand::Result, :cask do
describe "::_parse_plist" do
subject { described_class._parse_plist(command, input) }
let(:command) { Hbc::SystemCommand.new("/usr/bin/true", {}) }

View File

@ -1,4 +1,4 @@
describe Hbc::SystemCommand do
describe Hbc::SystemCommand, :cask do
describe "when the exit code is 0" do
describe "its result" do
subject { described_class.run("/usr/bin/true") }

View File

@ -1,4 +1,4 @@
describe Hbc::UnderscoreSupportingURI do
describe Hbc::UnderscoreSupportingURI, :cask do
describe "parse" do
it "works like normal on normal URLs" do
uri = Hbc::UnderscoreSupportingURI.parse("http://example.com/TestCask.dmg")

View File

@ -1,6 +1,4 @@
require "spec_helper"
describe Hbc::UrlChecker do
describe Hbc::UrlChecker, :cask do
describe "request processing" do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:checker) { Hbc::UrlChecker.new(cask) }

View File

@ -1,4 +1,4 @@
describe Hbc::Verify do
describe Hbc::Verify, :cask do
let(:cask) { double("cask") }
let(:verification_classes) {