Skip to content
Snippets Groups Projects
Commit 6da26069 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #763 from reitermarkus/dummy-containers

Use dummy containers for cask tests.
parents 7395ff20 0dc79d18
No related branches found
No related tags found
No related merge requests found
Showing
with 220 additions and 121 deletions
test_cask 'version-latest-with-checksum' do
version :latest
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
end
......@@ -24,7 +24,7 @@ describe Hbc::Artifact::App do
url TestHelper.local_binary_url("caffeine.zip")
homepage "http://example.com/local-caffeine"
version "1.2.3"
sha256 "9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
app "subdir/Caffeine.app", target: "AnotherName.app"
end
......@@ -53,7 +53,7 @@ describe Hbc::Artifact::App do
cask = local_alt_caffeine
staged_app_path = cask.staged_path.join("Caffeine.app")
staged_app_copy = staged_app_path.sub("Caffeine.app", "CaffeineAgain.app")
staged_app_copy = staged_app_path.sub("Caffeine.app", "Caffeine Deluxe.app")
FileUtils.cp_r staged_app_path, staged_app_copy
shutup do
......@@ -64,7 +64,7 @@ describe Hbc::Artifact::App do
File.exist?(staged_app_path).must_equal false
File.exist?(Hbc.appdir.join("AnotherNameAgain.app")).must_equal false
File.exist?(cask.staged_path.join("CaffeineAgain.app")).must_equal true
File.exist?(cask.staged_path.join("Caffeine Deluxe.app")).must_equal true
end
it "avoids clobbering an existing app by moving over it" do
......
......@@ -24,7 +24,7 @@ describe Hbc::Artifact::App do
url TestHelper.local_binary_url("caffeine.zip")
homepage "http://example.com/local-caffeine"
version "1.2.3"
sha256 "9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
app "subdir/Caffeine.app"
end
......@@ -53,7 +53,7 @@ describe Hbc::Artifact::App do
cask = local_caffeine
staged_app_path = cask.staged_path.join("Caffeine.app")
staged_app_copy = staged_app_path.sub("Caffeine.app", "CaffeineAgain.app")
staged_app_copy = staged_app_path.sub("Caffeine.app", "Caffeine Deluxe.app")
FileUtils.cp_r staged_app_path, staged_app_copy
shutup do
......@@ -63,8 +63,8 @@ describe Hbc::Artifact::App do
File.ftype(Hbc.appdir.join("Caffeine.app")).must_equal "directory"
File.exist?(staged_app_path).must_equal false
File.exist?(Hbc.appdir.join("CaffeineAgain.app")).must_equal false
File.exist?(cask.staged_path.join("CaffeineAgain.app")).must_equal true
File.exist?(Hbc.appdir.join("Caffeine Deluxe.app")).must_equal false
File.exist?(cask.staged_path.join("Caffeine Deluxe.app")).must_equal true
end
describe "when the target already exists" do
......
......@@ -7,9 +7,9 @@ describe Hbc::Artifact::Suite do
end
}
let(:expected_path) {
Hbc.appdir.join("caffeine_suite")
Hbc.appdir.join("Caffeine")
}
let(:source_path) { cask.staged_path.join("caffeine_suite") }
let(:source_path) { cask.staged_path.join("Caffeine") }
it "moves the suite to the proper directory" do
shutup do
......
......@@ -21,11 +21,11 @@ describe Hbc::Artifact::App do
Hbc::Artifact::App.new(cask).install_phase
end
File.ftype(Hbc.appdir.join("Caffeine.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine.app")).must_equal false
File.ftype(Hbc.appdir.join("Caffeine Mini.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine Mini.app")).must_equal false
File.ftype(Hbc.appdir.join("Caffeine-2.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine-2.app")).must_equal false
File.ftype(Hbc.appdir.join("Caffeine Pro.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine Pro.app")).must_equal false
end
it "works with an application in a subdir" do
......@@ -36,62 +36,63 @@ describe Hbc::Artifact::App do
Hbc::Artifact::App.new(cask).install_phase
end
File.ftype(Hbc.appdir.join("Caffeine.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine.app")).must_equal false
File.ftype(Hbc.appdir.join("Caffeine Mini.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine Mini.app")).must_equal false
File.ftype(Hbc.appdir.join("Caffeine-2.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine-2.app")).must_equal false
File.ftype(Hbc.appdir.join("Caffeine Pro.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine Pro.app")).must_equal false
end
it "only uses apps when they are specified" do
cask = local_two_apps_caffeine
app_path = cask.staged_path.join("Caffeine.app")
FileUtils.cp_r app_path, app_path.sub("Caffeine.app", "CaffeineAgain.app")
app_path = cask.staged_path.join("Caffeine Mini.app")
FileUtils.cp_r app_path, app_path.sub("Caffeine Mini.app", "Caffeine Deluxe.app")
shutup do
Hbc::Artifact::App.new(cask).install_phase
end
File.ftype(Hbc.appdir.join("Caffeine.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine.app")).must_equal false
File.ftype(Hbc.appdir.join("Caffeine Mini.app")).must_equal "directory"
File.exist?(cask.staged_path.join("Caffeine Mini.app")).must_equal false
File.exist?(Hbc.appdir.join("CaffeineAgain.app")).must_equal false
File.exist?(cask.staged_path.join("CaffeineAgain.app")).must_equal true
File.exist?(Hbc.appdir.join("Caffeine Deluxe.app")).must_equal false
File.exist?(cask.staged_path.join("Caffeine Deluxe.app")).must_equal true
end
it "avoids clobbering an existing app (app 1)" do
cask = local_two_apps_caffeine
Hbc.appdir.join("Caffeine.app").mkpath
describe "avoids clobbering an existing app" do
let(:cask) { local_two_apps_caffeine }
TestHelper.must_output(self, lambda {
Hbc::Artifact::App.new(cask).install_phase
}, <<-MESSAGE.undent.chomp)
==> Moving App 'Caffeine-2.app' to '#{Hbc.appdir.join('Caffeine-2.app')}'
==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine.app')}'; not moving.
MESSAGE
it "when the first app of two already exists" do
Hbc.appdir.join("Caffeine Mini.app").mkpath
source_path = cask.staged_path.join("Caffeine.app")
TestHelper.must_output(self, lambda {
Hbc::Artifact::App.new(cask).install_phase
}, <<-EOS.undent.chomp)
==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine Mini.app')}'; not moving.
==> Moving App 'Caffeine Pro.app' to '#{Hbc.appdir.join('Caffeine Pro.app')}'
EOS
File.identical?(source_path, Hbc.appdir.join("Caffeine.app")).must_equal false
end
source_path = cask.staged_path.join("Caffeine Mini.app")
it "avoids clobbering an existing app (app 2)" do
cask = local_two_apps_caffeine
File.identical?(source_path, Hbc.appdir.join("Caffeine Mini.app")).must_equal false
end
Hbc.appdir.join("Caffeine-2.app").mkpath
it "when the second app of two already exists" do
Hbc.appdir.join("Caffeine Pro.app").mkpath
TestHelper.must_output(self, lambda {
Hbc::Artifact::App.new(cask).install_phase
}, <<-MESSAGE.undent.chomp)
==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine-2.app')}'; not moving.
==> Moving App 'Caffeine.app' to '#{Hbc.appdir.join('Caffeine.app')}'
MESSAGE
TestHelper.must_output(self, lambda {
Hbc::Artifact::App.new(cask).install_phase
}, <<-EOS.undent.chomp)
==> Moving App 'Caffeine Mini.app' to '#{Hbc.appdir.join('Caffeine Mini.app')}'
==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine Pro.app')}'; not moving.
EOS
source_path = cask.staged_path.join("Caffeine-2.app")
source_path = cask.staged_path.join("Caffeine Pro.app")
File.identical?(source_path, Hbc.appdir.join("Caffeine-2.app")).must_equal false
File.identical?(source_path, Hbc.appdir.join("Caffeine Pro.app")).must_equal false
end
end
end
end
......@@ -16,151 +16,151 @@ describe Hbc::Installer do
end
it "works with dmg-based Casks" do
transmission = Hbc.load("local-transmission")
asset = Hbc.load("container-dmg")
shutup do
Hbc::Installer.new(transmission).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("local-transmission", transmission.version)
dest_path = Hbc.caskroom.join("container-dmg", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("Transmission.app")
application.must_be :directory?
file = Hbc.appdir.join("container")
file.must_be :file?
end
it "works with tar-based Casks" do
tarball = Hbc.load("tarball")
it "works with tar-gz-based Casks" do
asset = Hbc.load("container-tar-gz")
shutup do
Hbc::Installer.new(tarball).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("tarball", tarball.version)
dest_path = Hbc.caskroom.join("container-tar-gz", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("Tarball.app")
application.must_be :directory?
application = Hbc.appdir.join("container")
application.must_be :file?
end
it "works with cab-based Casks" do
skip("cabextract not installed") unless Hbc.homebrew_prefix.join("bin", "cabextract").exist?
cab_container = Hbc.load("cab-container")
asset = Hbc.load("cab-container")
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
cab_container.stubs(:depends_on).returns(empty)
asset.stubs(:depends_on).returns(empty)
shutup do
Hbc::Installer.new(cab_container).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("cab-container", cab_container.version)
dest_path = Hbc.caskroom.join("cab-container", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("Application.app")
application.must_be :directory?
application = Hbc.appdir.join("container")
application.must_be :file?
end
it "works with Adobe AIR-based Casks" do
skip("Adobe AIR not installed") unless Hbc::Container::Air.installer_exist?
air_container = Hbc.load("adobe-air-container")
asset = Hbc.load("container-air")
shutup do
Hbc::Installer.new(air_container).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("adobe-air-container", air_container.version)
dest_path = Hbc.caskroom.join("container-air", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("GMDesk.app")
application = Hbc.appdir.join("container.app")
application.must_be :directory?
end
it "works with 7z-based Casks" do
skip("unar not installed") unless Hbc.homebrew_prefix.join("bin", "unar").exist?
sevenzip_container = Hbc.load("sevenzip-container")
asset = Hbc.load("container-7z")
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
sevenzip_container.stubs(:depends_on).returns(empty)
asset.stubs(:depends_on).returns(empty)
shutup do
Hbc::Installer.new(sevenzip_container).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("sevenzip-container", sevenzip_container.version)
dest_path = Hbc.caskroom.join("container-7z", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("Application.app")
application.must_be :directory?
file = Hbc.appdir.join("container")
file.must_be :file?
end
it "works with xar-based Casks" do
xar_container = Hbc.load("xar-container")
asset = Hbc.load("container-xar")
shutup do
Hbc::Installer.new(xar_container).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("xar-container", xar_container.version)
dest_path = Hbc.caskroom.join("container-xar", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("Application.app")
application.must_be :directory?
file = Hbc.appdir.join("container")
file.must_be :file?
end
it "works with Stuffit-based Casks" do
skip("unar not installed") unless Hbc.homebrew_prefix.join("bin", "unar").exist?
stuffit_container = Hbc.load("stuffit-container")
asset = Hbc.load("container-sit")
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
stuffit_container.stubs(:depends_on).returns(empty)
asset.stubs(:depends_on).returns(empty)
shutup do
Hbc::Installer.new(stuffit_container).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("stuffit-container", stuffit_container.version)
dest_path = Hbc.caskroom.join("container-sit", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("sheldonmac", "v1.0")
application.must_be :directory?
application = Hbc.appdir.join("container")
application.must_be :file?
end
it "works with RAR-based Casks" do
skip("unar not installed") unless Hbc.homebrew_prefix.join("bin", "unar").exist?
rar_container = Hbc.load("rar-container")
asset = Hbc.load("container-rar")
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
rar_container.stubs(:depends_on).returns(empty)
asset.stubs(:depends_on).returns(empty)
shutup do
Hbc::Installer.new(rar_container).install
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("rar-container", rar_container.version)
dest_path = Hbc.caskroom.join("container-rar", asset.version)
dest_path.must_be :directory?
application = Hbc.appdir.join("Application.app")
application.must_be :directory?
application = Hbc.appdir.join("container")
application.must_be :file?
end
it "works with bz2-based Casks" do
asset = Hbc.load("bzipped-asset")
it "works with pure bzip2-based Casks" do
asset = Hbc.load("container-bzip2")
shutup do
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("bzipped-asset", asset.version)
dest_path = Hbc.caskroom.join("container-bzip2", asset.version)
dest_path.must_be :directory?
file = Hbc.appdir.join("bzipped-asset--#{asset.version}")
file = Hbc.appdir.join("container-bzip2--#{asset.version}")
file.must_be :file?
end
it "works with pure gz-based Casks" do
asset = Hbc.load("gzipped-asset")
it "works with pure gzip-based Casks" do
asset = Hbc.load("container-gzip")
shutup do
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("gzipped-asset", asset.version)
dest_path = Hbc.caskroom.join("container-gzip", asset.version)
dest_path.must_be :directory?
file = Hbc.appdir.join("gzipped-asset--#{asset.version}")
file = Hbc.appdir.join("container-gzip--#{asset.version}")
file.must_be :file?
end
it "works with xz-based Casks" do
it "works with pure xz-based Casks" do
skip("unxz not installed") unless Hbc.homebrew_prefix.join("bin", "unxz").exist?
asset = Hbc.load("xzipped-asset")
asset = Hbc.load("container-xz")
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
asset.stubs(:depends_on).returns(empty)
......@@ -168,15 +168,15 @@ describe Hbc::Installer do
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("xzipped-asset", asset.version)
dest_path = Hbc.caskroom.join("container-xz", asset.version)
dest_path.must_be :directory?
file = Hbc.appdir.join("xzipped-asset--#{asset.version}")
file = Hbc.appdir.join("container-xz--#{asset.version}")
file.must_be :file?
end
it "works with lzma-based Casks" do
skip("unlzma not installed") unless Hbc.homebrew_prefix.join("bin", "unlzma").exist?
asset = Hbc.load("lzma-asset")
asset = Hbc.load("container-lzma")
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
asset.stubs(:depends_on).returns(empty)
......@@ -184,9 +184,9 @@ describe Hbc::Installer do
Hbc::Installer.new(asset).install
end
dest_path = Hbc.caskroom.join("lzma-asset", asset.version)
dest_path = Hbc.caskroom.join("container-lzma", asset.version)
dest_path.must_be :directory?
file = Hbc.appdir.join("lzma-asset--#{asset.version}")
file = Hbc.appdir.join("container-lzma--#{asset.version}")
file.must_be :file?
end
......@@ -316,15 +316,15 @@ describe Hbc::Installer do
end # wont_raise
end
it "works properly with a direct URL to a pkg" do
naked_pkg = Hbc.load("naked-pkg")
it "works naked-pkg-based Casks" do
naked_pkg = Hbc.load("container-pkg")
shutup do
Hbc::Installer.new(naked_pkg).install
end
dest_path = Hbc.caskroom.join("naked-pkg", naked_pkg.version)
pkg = dest_path.join("Naked.pkg")
dest_path = Hbc.caskroom.join("container-pkg", naked_pkg.version)
pkg = dest_path.join("container.pkg")
pkg.must_be :file?
end
......
test_cask 'adobe-air-container' do
version '1.0.1'
sha256 '9b6e4174afa76f2af50238364fcf87525bc4ed2287acbe62925107ab6cda5c99'
url TestHelper.local_binary_url('GMDesk-1.01.air')
homepage 'http://robertnyman.com/gmdesk/'
app 'GMDesk.app'
end
test_cask 'appdir-interpolation' do
version '2.61'
sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
url TestHelper.local_binary_url('transmission-2.61.dmg')
homepage 'http://example.com/appdir-interpolation'
......
test_cask 'auto-updates' do
version '2.61'
sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
url TestHelper.local_binary_url('transmission-2.61.dmg')
homepage 'http://example.com/auto-updates'
......
test_cask 'container-7z' do
version '1.2.3'
sha256 '3f9542ace85ed5f88549e2d0ea82210f8ddc87e0defbb78469d3aed719b3c964'
url TestHelper.local_binary_url('container.7z')
homepage 'https://example.com/container-7z'
depends_on formula: 'unar'
app 'container'
end
test_cask 'container-air' do
version '0.1'
sha256 '554472e163f8a028629b12b468e29acda9f16b223dff74fcd218bba73cc2365a'
url TestHelper.local_binary_url('container.air')
homepage 'https://example.com/container-air'
app 'container.app'
end
test_cask 'bzipped-asset' do
test_cask 'container-bzip2' do
version '1.2.3'
sha256 'eaf67b3a62cb9275f96e45d05c70b94bef9ef1dae344083e93eda6b0b388a61c'
url TestHelper.local_binary_url('bzipped_asset.bz2')
homepage 'http://example.com/bzipped-asset'
url TestHelper.local_binary_url('container.bz2')
homepage 'https://example.com/container-bzip2'
app 'bzipped-asset--1.2.3'
app 'container-bzip2--1.2.3'
end
test_cask 'cab-container' do
test_cask 'container-cab' do
version '1.2.3'
sha256 '192d0cf6b727473f9ba0f55cec793ee2a8f7113c5cfe9d49e05a087436c5efe2'
sha256 'c267f5cebb14814c8e612a8b7d2bda02aec913f869509b6f1d3883427c0f552b'
url TestHelper.local_binary_url('cabcontainer.cab')
homepage 'http://example.com/cab-container'
url TestHelper.local_binary_url('container.cab')
homepage 'https://example.com/container-cab'
depends_on formula: 'cabextract'
......
test_cask 'container-dmg' do
version '1.2.3'
sha256 '74d89d4fa5cef175cf43666ce11fefa3741aa1522114042ac75e656be37141a1'
url TestHelper.local_binary_url('container.dmg')
homepage 'https://example.com/container-dmg'
app 'container'
end
test_cask 'container-gzip' do
version '1.2.3'
sha256 'fa4ebb5246583c4b6e62e1df4e3b71b4e38a1d7d91c025665827195d36214b20'
url TestHelper.local_binary_url('container.gz')
homepage 'https://example.com/container-gzip'
app 'container-gzip--1.2.3'
end
test_cask 'lzma-asset' do
test_cask 'container-lzma' do
version '1.2.3'
sha256 '9d7edb32d02ab9bd9749a5bde8756595ea4cfcb1da02ca11c30fb591d4c1ed85'
url TestHelper.local_binary_url('lzma-asset.lzma')
homepage 'http://example.com/xzipped-asset'
url TestHelper.local_binary_url('container.lzma')
homepage 'https://example.com/container-lzma'
depends_on formula: 'lzma'
app 'lzma-asset--1.2.3'
app 'container-lzma--1.2.3'
end
test_cask 'naked-pkg' do
test_cask 'container-pkg' do
version '1.2.3'
sha256 '611c50c8a2a2098951d2cd0fd54787ed81b92cd97b4b08bd7cba17f1e1d8e40b'
url TestHelper.local_binary_url('Naked.pkg')
homepage 'http://example.com/naked-pkg'
url TestHelper.local_binary_url('container.pkg')
homepage 'https://example.com/container-pkg'
end
test_cask 'container-rar' do
version '1.2.3'
sha256 '419af7864c0e1f125515c49b08bd22e0f7de39f5285897c440fe03c714871763'
url TestHelper.local_binary_url('container.rar')
homepage 'https://example.com/container-rar'
depends_on formula: 'unar'
app 'container'
end
test_cask 'container-sit' do
version '1.2.3'
sha256 '0d21a64dce625044345c8ecca888e5439feaf254dac7f884917028a744f93cf3'
url TestHelper.local_binary_url('container.sit')
homepage 'https://example.com/container-sit'
depends_on formula: 'unar'
app 'container'
end
test_cask 'container-tar-gz' do
version '1.2.3'
sha256 'fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5'
url TestHelper.local_binary_url('container.tar.gz')
homepage 'https://example.com/container-tar-gz'
app 'container'
end
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