Skip to content
Snippets Groups Projects
Commit f717831a authored by Markus Reiter's avatar Markus Reiter
Browse files

Move Cask fixtures to `test/support/fixtures`.

parent 35045b29
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 94 deletions
......@@ -3,7 +3,7 @@ require "test_helper"
describe Hbc::Container::Dmg do
describe "mount!" do
it "does not store nil mounts for dmgs with extra data" do
transmission = Hbc.load("local-transmission")
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
dmg = Hbc::Container::Dmg.new(
transmission,
......
......@@ -13,7 +13,7 @@ describe "Satisfy Dependencies and Requirements" do
describe "depends_on cask" do
it "raises an exception when depends_on cask is cyclic" do
dep_cask = Hbc.load("with-depends-on-cask-cyclic")
dep_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-cyclic.rb")
lambda {
shutup do
Hbc::Installer.new(dep_cask).install
......@@ -22,7 +22,7 @@ describe "Satisfy Dependencies and Requirements" do
end
it "installs the dependency of a Cask and the Cask itself" do
csk = Hbc.load("with-depends-on-cask")
csk = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask.rb")
dependency = Hbc.load(csk.depends_on.cask.first)
shutup do
Hbc::Installer.new(csk).install
......@@ -35,35 +35,35 @@ describe "Satisfy Dependencies and Requirements" do
describe "depends_on macos" do
it "understands depends_on macos: <array>" do
macos_cask = Hbc.load("with-depends-on-macos-array")
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-array.rb")
shutup do
Hbc::Installer.new(macos_cask).install
end
end
it "understands depends_on macos: <comparison>" do
macos_cask = Hbc.load("with-depends-on-macos-comparison")
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-comparison.rb")
shutup do
Hbc::Installer.new(macos_cask).install
end
end
it "understands depends_on macos: <string>" do
macos_cask = Hbc.load("with-depends-on-macos-string")
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-string.rb")
shutup do
Hbc::Installer.new(macos_cask).install
end
end
it "understands depends_on macos: <symbol>" do
macos_cask = Hbc.load("with-depends-on-macos-symbol")
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-symbol.rb")
shutup do
Hbc::Installer.new(macos_cask).install
end
end
it "raises an exception when depends_on macos is not satisfied" do
macos_cask = Hbc.load("with-depends-on-macos-failure")
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-failure.rb")
lambda {
shutup do
Hbc::Installer.new(macos_cask).install
......@@ -74,7 +74,7 @@ describe "Satisfy Dependencies and Requirements" do
describe "depends_on arch" do
it "succeeds when depends_on arch is satisfied" do
arch_cask = Hbc.load("with-depends-on-arch")
arch_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-arch.rb")
shutup do
Hbc::Installer.new(arch_cask).install
end
......@@ -83,7 +83,7 @@ describe "Satisfy Dependencies and Requirements" do
describe "depends_on x11" do
it "succeeds when depends_on x11 is satisfied" do
x11_cask = Hbc.load("with-depends-on-x11")
x11_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb")
MacOS::X11.stubs(:installed?).returns(true)
shutup do
Hbc::Installer.new(x11_cask).install
......@@ -91,7 +91,7 @@ describe "Satisfy Dependencies and Requirements" do
end
it "raises an exception when depends_on x11 is not satisfied" do
x11_cask = Hbc.load("with-depends-on-x11")
x11_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb")
MacOS::X11.stubs(:installed?).returns(false)
lambda {
shutup do
......@@ -101,7 +101,7 @@ describe "Satisfy Dependencies and Requirements" do
end
it "never raises when depends_on x11: false" do
x11_cask = Hbc.load("with-depends-on-x11-false")
x11_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11-false.rb")
MacOS::X11.stubs(:installed?).returns(false)
lambda do
shutup do
......
require "test_helper"
describe Hbc::DSL::Caveats do
let(:cask) { Hbc.load("basic-cask") }
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::Caveats.new(cask) }
it_behaves_like Hbc::DSL::Base
......
require "test_helper"
describe Hbc::DSL::Postflight do
let(:cask) { Hbc.load("basic-cask") }
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::Postflight.new(cask, Hbc::FakeSystemCommand) }
it_behaves_like Hbc::DSL::Base
......
require "test_helper"
describe Hbc::DSL::Preflight do
let(:cask) { Hbc.load("basic-cask") }
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::Preflight.new(cask, Hbc::FakeSystemCommand) }
it_behaves_like Hbc::DSL::Base
......
require "test_helper"
describe Hbc::DSL::UninstallPostflight do
let(:cask) { Hbc.load("basic-cask") }
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::UninstallPostflight.new(cask, Hbc::FakeSystemCommand) }
it_behaves_like Hbc::DSL::Base
......
require "test_helper"
describe Hbc::DSL::UninstallPreflight do
let(:cask) { Hbc.load("basic-cask") }
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:dsl) { Hbc::DSL::UninstallPreflight.new(cask, Hbc::FakeSystemCommand) }
it_behaves_like Hbc::DSL::Base
......
......@@ -2,7 +2,7 @@ require "test_helper"
describe Hbc::DSL do
it "lets you set url, homepage, and version" do
test_cask = Hbc.load("basic-cask")
test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb")
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
test_cask.homepage.must_equal "http://example.com/"
test_cask.version.to_s.must_equal "1.2.3"
......@@ -48,20 +48,20 @@ describe Hbc::DSL do
describe "header line" do
it "requires a valid header format" do
lambda {
Hbc.load("invalid/invalid-header-format")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-header-format.rb")
}.must_raise(SyntaxError)
end
it "requires the header token to match the file name" do
err = lambda {
Hbc.load("invalid/invalid-header-token-mismatch")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-header-token-mismatch.rb")
}.must_raise(Hbc::CaskTokenDoesNotMatchError)
err.message.must_include "Bad header line:"
err.message.must_include "does not match file name"
end
it "does not require a DSL version in the header" do
test_cask = Hbc.load("no-dsl-version")
test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-dsl-version.rb")
test_cask.token.must_equal "no-dsl-version"
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
test_cask.homepage.must_equal "http://example.com/"
......@@ -75,7 +75,7 @@ describe Hbc::DSL do
ENV.stub :[], stub do
shutup do
test_cask = Hbc.load("with-dsl-version")
test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-dsl-version.rb")
test_cask.token.must_equal "with-dsl-version"
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
test_cask.homepage.must_equal "http://example.com/"
......@@ -233,7 +233,7 @@ describe Hbc::DSL do
describe "url stanza" do
it "prevents defining multiple urls" do
err = lambda {
Hbc.load("invalid/invalid-two-url")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-url.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'url' stanza may only appear once"
end
......@@ -242,7 +242,7 @@ describe Hbc::DSL do
describe "homepage stanza" do
it "prevents defining multiple homepages" do
err = lambda {
Hbc.load("invalid/invalid-two-homepage")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-homepage.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'homepage' stanza may only appear once"
end
......@@ -251,7 +251,7 @@ describe Hbc::DSL do
describe "version stanza" do
it "prevents defining multiple versions" do
err = lambda {
Hbc.load("invalid/invalid-two-version")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-version.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'version' stanza may only appear once"
end
......@@ -259,77 +259,77 @@ describe Hbc::DSL do
describe "appcast stanza" do
it "allows appcasts to be specified" do
cask = Hbc.load("with-appcast")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-appcast.rb")
cask.appcast.to_s.must_match(/^http/)
end
it "prevents defining multiple appcasts" do
err = lambda {
Hbc.load("invalid/invalid-appcast-multiple")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-appcast-multiple.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'appcast' stanza may only appear once"
end
it "refuses to load invalid appcast URLs" do
lambda {
Hbc.load("invalid/invalid-appcast-url")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-appcast-url.rb")
}.must_raise(Hbc::CaskInvalidError)
end
end
describe "gpg stanza" do
it "allows gpg stanza to be specified" do
cask = Hbc.load("with-gpg")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-gpg.rb")
cask.gpg.to_s.must_match(/\S/)
end
it "allows gpg stanza to be specified with :key_url" do
cask = Hbc.load("with-gpg-key-url")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-gpg-key-url.rb")
cask.gpg.to_s.must_match(/\S/)
end
it "prevents specifying gpg stanza multiple times" do
err = lambda {
Hbc.load("invalid/invalid-gpg-multiple-stanzas")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'gpg' stanza may only appear once"
end
it "prevents missing gpg key parameters" do
err = lambda {
Hbc.load("invalid/invalid-gpg-missing-key")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-missing-key.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'gpg' stanza must include exactly one"
end
it "prevents conflicting gpg key parameters" do
err = lambda {
Hbc.load("invalid/invalid-gpg-conflicting-keys")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-conflicting-keys.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'gpg' stanza must include exactly one"
end
it "refuses to load invalid gpg signature URLs" do
lambda {
Hbc.load("invalid/invalid-gpg-signature-url")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-signature-url.rb")
}.must_raise(Hbc::CaskInvalidError)
end
it "refuses to load invalid gpg key URLs" do
lambda {
Hbc.load("invalid/invalid-gpg-key-url")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-key-url.rb")
}.must_raise(Hbc::CaskInvalidError)
end
it "refuses to load invalid gpg key IDs" do
lambda {
Hbc.load("invalid/invalid-gpg-key-id")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-key-id.rb")
}.must_raise(Hbc::CaskInvalidError)
end
it "refuses to load if gpg parameter is unknown" do
lambda {
Hbc.load("invalid/invalid-gpg-parameter")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-parameter.rb")
}.must_raise(Hbc::CaskInvalidError)
end
end
......@@ -337,112 +337,112 @@ describe Hbc::DSL do
describe "depends_on stanza" do
it "refuses to load with an invalid depends_on key" do
lambda {
Hbc.load("invalid/invalid-depends-on-key")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-key.rb")
}.must_raise(Hbc::CaskInvalidError)
end
end
describe "depends_on formula" do
it "allows depends_on formula to be specified" do
cask = Hbc.load("with-depends-on-formula")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-formula.rb")
cask.depends_on.formula.wont_be_nil
end
it "allows multiple depends_on formula to be specified" do
cask = Hbc.load("with-depends-on-formula-multiple")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-formula-multiple.rb")
cask.depends_on.formula.wont_be_nil
end
end
describe "depends_on cask" do
it "allows depends_on cask to be specified" do
cask = Hbc.load("with-depends-on-cask")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask.rb")
cask.depends_on.cask.wont_be_nil
end
it "allows multiple depends_on cask to be specified" do
cask = Hbc.load("with-depends-on-cask-multiple")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb")
cask.depends_on.cask.wont_be_nil
end
end
describe "depends_on macos" do
it "allows depends_on macos to be specified" do
cask = Hbc.load("with-depends-on-macos-string")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-string.rb")
cask.depends_on.macos.wont_be_nil
end
it "refuses to load with an invalid depends_on macos value" do
lambda {
Hbc.load("invalid/invalid-depends-on-macos-bad-release")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb")
}.must_raise(Hbc::CaskInvalidError)
end
it "refuses to load with conflicting depends_on macos forms" do
lambda {
Hbc.load("invalid/invalid-depends-on-macos-conflicting-forms")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb")
}.must_raise(Hbc::CaskInvalidError)
end
end
describe "depends_on arch" do
it "allows depends_on arch to be specified" do
cask = Hbc.load("with-depends-on-arch")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-arch.rb")
cask.depends_on.arch.wont_be_nil
end
it "refuses to load with an invalid depends_on arch value" do
lambda {
Hbc.load("invalid/invalid-depends-on-arch-value")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-arch-value.rb")
}.must_raise(Hbc::CaskInvalidError)
end
end
describe "depends_on x11" do
it "allows depends_on x11 to be specified" do
cask = Hbc.load("with-depends-on-x11")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb")
cask.depends_on.x11.wont_be_nil
end
it "refuses to load with an invalid depends_on x11 value" do
lambda {
Hbc.load("invalid/invalid-depends-on-x11-value")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-x11-value.rb")
}.must_raise(Hbc::CaskInvalidError)
end
end
describe "conflicts_with stanza" do
it "allows conflicts_with stanza to be specified" do
cask = Hbc.load("with-conflicts-with")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-conflicts-with.rb")
cask.conflicts_with.formula.wont_be_nil
end
it "refuses to load invalid conflicts_with key" do
lambda {
Hbc.load("invalid/invalid-conflicts-with-key")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-conflicts-with-key.rb")
}.must_raise(Hbc::CaskInvalidError)
end
end
describe "installer stanza" do
it "allows installer script to be specified" do
cask = Hbc.load("with-installer-script")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-script.rb")
cask.artifacts[:installer].first.script[:executable].must_equal "/usr/bin/true"
cask.artifacts[:installer].first.script[:args].must_equal ["--flag"]
cask.artifacts[:installer].to_a[1].script[:executable].must_equal "/usr/bin/false"
cask.artifacts[:installer].to_a[1].script[:args].must_equal ["--flag"]
end
it "allows installer manual to be specified" do
cask = Hbc.load("with-installer-manual")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-manual.rb")
cask.artifacts[:installer].first.manual.must_equal "Caffeine.app"
end
end
describe "stage_only stanza" do
it "allows stage_only stanza to be specified" do
cask = Hbc.load("stage-only")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/stage-only.rb")
cask.artifacts[:stage_only].first.must_equal [true]
end
it "prevents specifying stage_only with other activatables" do
err = lambda {
Hbc.load("invalid/invalid-stage-only-conflict")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-stage-only-conflict.rb")
}.must_raise(Hbc::CaskInvalidError)
err.message.must_include "'stage_only' must be the only activatable artifact"
end
......@@ -450,14 +450,14 @@ describe Hbc::DSL do
describe "auto_updates stanza" do
it "allows auto_updates stanza to be specified" do
cask = Hbc.load("auto-updates")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
cask.auto_updates.must_equal true
end
end
describe "appdir" do
it "allows interpolation of the appdir value in stanzas" do
cask = Hbc.load("appdir-interpolation")
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/appdir-interpolation.rb")
cask.artifacts[:binary].first.must_equal ["#{Hbc.appdir}/some/path"]
end
......
......@@ -7,7 +7,7 @@ describe Hbc::Installer do
}
it "downloads and installs a nice fresh Cask" do
caffeine = Hbc.load("local-caffeine")
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
shutup do
Hbc::Installer.new(caffeine).install
......@@ -20,7 +20,7 @@ describe Hbc::Installer do
end
it "works with dmg-based Casks" do
asset = Hbc.load("container-dmg")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-dmg.rb")
shutup do
Hbc::Installer.new(asset).install
......@@ -33,7 +33,7 @@ describe Hbc::Installer do
end
it "works with tar-gz-based Casks" do
asset = Hbc.load("container-tar-gz")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-tar-gz.rb")
shutup do
Hbc::Installer.new(asset).install
......@@ -47,7 +47,7 @@ describe Hbc::Installer do
it "works with cab-based Casks" do
skip("cabextract not installed") if which("cabextract").nil?
asset = Hbc.load("container-cab")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-cab.rb")
asset.stub :depends_on, empty_depends_on_stub do
shutup do
......@@ -63,7 +63,7 @@ describe Hbc::Installer do
it "works with Adobe AIR-based Casks" do
skip("Adobe AIR not installed") unless Hbc::Container::Air.installer_exist?
asset = Hbc.load("container-air")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-air.rb")
shutup do
Hbc::Installer.new(asset).install
......@@ -77,7 +77,7 @@ describe Hbc::Installer do
it "works with 7z-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc.load("container-7z")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-7z.rb")
asset.stub :depends_on, empty_depends_on_stub do
shutup do
......@@ -92,7 +92,7 @@ describe Hbc::Installer do
end
it "works with xar-based Casks" do
asset = Hbc.load("container-xar")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xar.rb")
shutup do
Hbc::Installer.new(asset).install
......@@ -106,7 +106,7 @@ describe Hbc::Installer do
it "works with Stuffit-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc.load("container-sit")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-sit.rb")
asset.stub :depends_on, empty_depends_on_stub do
shutup do
......@@ -122,7 +122,7 @@ describe Hbc::Installer do
it "works with RAR-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc.load("container-rar")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-rar.rb")
asset.stub :depends_on, empty_depends_on_stub do
shutup do
......@@ -137,7 +137,7 @@ describe Hbc::Installer do
end
it "works with pure bzip2-based Casks" do
asset = Hbc.load("container-bzip2")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-bzip2.rb")
shutup do
Hbc::Installer.new(asset).install
......@@ -150,7 +150,7 @@ describe Hbc::Installer do
end
it "works with pure gzip-based Casks" do
asset = Hbc.load("container-gzip")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-gzip.rb")
shutup do
Hbc::Installer.new(asset).install
......@@ -164,7 +164,7 @@ describe Hbc::Installer do
it "works with pure xz-based Casks" do
skip("unxz not installed") if which("unxz").nil?
asset = Hbc.load("container-xz")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xz.rb")
asset.stub :depends_on, empty_depends_on_stub do
shutup do
......@@ -180,7 +180,7 @@ describe Hbc::Installer do
it "works with lzma-based Casks" do
skip("unlzma not installed") if which("unlzma").nil?
asset = Hbc.load("container-lzma")
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-lzma.rb")
asset.stub :depends_on, empty_depends_on_stub do
shutup do
......@@ -195,7 +195,7 @@ describe Hbc::Installer do
end
it "blows up on a bad checksum" do
bad_checksum = Hbc.load("bad-checksum")
bad_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/bad-checksum.rb")
lambda {
shutup do
Hbc::Installer.new(bad_checksum).install
......@@ -204,7 +204,7 @@ describe Hbc::Installer do
end
it "blows up on a missing checksum" do
missing_checksum = Hbc.load("missing-checksum")
missing_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/missing-checksum.rb")
lambda {
shutup do
Hbc::Installer.new(missing_checksum).install
......@@ -213,7 +213,7 @@ describe Hbc::Installer do
end
it "installs fine if sha256 :no_check is used" do
no_checksum = Hbc.load("no-checksum")
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
shutup do
Hbc::Installer.new(no_checksum).install
......@@ -223,14 +223,14 @@ describe Hbc::Installer do
end
it "fails to install if sha256 :no_check is used with --require-sha" do
no_checksum = Hbc.load("no-checksum")
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
lambda {
Hbc::Installer.new(no_checksum, require_sha: true).install
}.must_raise(Hbc::CaskNoShasumError)
end
it "installs fine if sha256 :no_check is used with --require-sha and --force" do
no_checksum = Hbc.load("no-checksum")
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
......@@ -240,7 +240,7 @@ describe Hbc::Installer do
end
it "prints caveats if they're present" do
with_caveats = Hbc.load("with-caveats")
with_caveats = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-caveats.rb")
lambda {
Hbc::Installer.new(with_caveats).install
}.must_output(/Here are some things you might want to know/)
......@@ -248,7 +248,7 @@ describe Hbc::Installer do
end
it "prints installer :manual instructions when present" do
with_installer_manual = Hbc.load("with-installer-manual")
with_installer_manual = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-manual.rb")
lambda {
Hbc::Installer.new(with_installer_manual).install
}.must_output(/To complete the installation of Cask with-installer-manual, you must also\nrun the installer at\n\n '#{with_installer_manual.staged_path.join('Caffeine.app')}'/)
......@@ -256,7 +256,7 @@ describe Hbc::Installer do
end
it "does not extract __MACOSX directories from zips" do
with_macosx_dir = Hbc.load("with-macosx-dir")
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
......@@ -266,7 +266,7 @@ describe Hbc::Installer do
end
it "installer method raises an exception when already-installed Casks which auto-update are attempted" do
auto_updates = Hbc.load("auto-updates")
auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
auto_updates.installed?.must_equal false
installer = Hbc::Installer.new(auto_updates)
......@@ -280,7 +280,7 @@ describe Hbc::Installer do
end
it "allows already-installed Casks which auto-update to be installed if force is provided" do
auto_updates = Hbc.load("auto-updates")
auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
auto_updates.installed?.must_equal false
shutup do
......@@ -294,7 +294,7 @@ describe Hbc::Installer do
# unlike the CLI, the internal interface throws exception on double-install
it "installer method raises an exception when already-installed Casks are attempted" do
transmission = Hbc.load("local-transmission")
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
transmission.installed?.must_equal false
installer = Hbc::Installer.new(transmission)
......@@ -308,7 +308,7 @@ describe Hbc::Installer do
end
it "allows already-installed Casks to be installed if force is provided" do
transmission = Hbc.load("local-transmission")
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
transmission.installed?.must_equal false
shutup do
......@@ -321,7 +321,7 @@ describe Hbc::Installer do
end
it "works naked-pkg-based Casks" do
naked_pkg = Hbc.load("container-pkg")
naked_pkg = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-pkg.rb")
shutup do
Hbc::Installer.new(naked_pkg).install
......@@ -333,7 +333,7 @@ describe Hbc::Installer do
end
it "works properly with an overridden container :type" do
naked_executable = Hbc.load("naked-executable")
naked_executable = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/naked-executable.rb")
shutup do
Hbc::Installer.new(naked_executable).install
......@@ -345,7 +345,7 @@ describe Hbc::Installer do
end
it "works fine with a nested container" do
nested_app = Hbc.load("nested-app")
nested_app = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb")
shutup do
Hbc::Installer.new(nested_app).install
......@@ -356,7 +356,7 @@ describe Hbc::Installer do
end
it "generates and finds a timestamped metadata directory for an installed Cask" do
caffeine = Hbc.load("local-caffeine")
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
shutup do
Hbc::Installer.new(caffeine).install
......@@ -368,7 +368,7 @@ describe Hbc::Installer do
end
it "generates and finds a metadata subdirectory for an installed Cask" do
caffeine = Hbc.load("local-caffeine")
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
shutup do
Hbc::Installer.new(caffeine).install
......@@ -383,7 +383,7 @@ describe Hbc::Installer do
describe "uninstall" do
it "fully uninstalls a Cask" do
caffeine = Hbc.load("local-caffeine")
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
installer = Hbc::Installer.new(caffeine)
shutup do
......@@ -397,7 +397,7 @@ describe Hbc::Installer do
end
it "uninstalls all versions if force is set" do
caffeine = Hbc.load("local-caffeine")
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
mutated_version = caffeine.version + ".1"
shutup do
......
......@@ -6,7 +6,7 @@ require "test_helper"
describe "Operations on staged Casks" do
describe "bundle ID" do
it "fetches the bundle ID from a staged cask" do
transmission_cask = Hbc.load("local-transmission")
transmission_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
tr_installer = Hbc::Installer.new(transmission_cask)
shutup do
......
......@@ -2,7 +2,7 @@ require "test_helper"
describe Hbc::UrlChecker do
describe "request processing" do
let(:cask) { Hbc.load("basic-cask") }
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
let(:checker) { Hbc::UrlChecker.new(cask) }
let(:with_stubbed_fetcher) {
lambda { |&block|
......
......@@ -41,8 +41,8 @@ describe "Cask" do
end
it "uses exact match when loading by token" do
Hbc.load("test-opera").token.must_equal("test-opera")
Hbc.load("test-opera-mail").token.must_equal("test-opera-mail")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/test-opera.rb").token.must_equal("test-opera")
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/test-opera-mail.rb").token.must_equal("test-opera-mail")
end
it "raises an error when attempting to load a Cask that doesn't exist" do
......
......@@ -46,7 +46,7 @@ Hbc.caskroom = Hbc.default_caskroom.tap(&:mkpath)
Hbc.default_tap = Tap.fetch("caskroom", "test").tap do |tap|
# link test casks
FileUtils.mkdir_p tap.path.dirname
FileUtils.ln_s Pathname.new(__FILE__).dirname.join("support"), tap.path
FileUtils.ln_s TEST_FIXTURE_DIR.join("cask"), tap.path
end
# pretend that the caskroom/cask Tap is installed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment