Refactor Installer test.
This commit is contained in:
parent
0c140f0970
commit
4a9b48e9a6
@ -2,6 +2,10 @@ require "test_helper"
|
|||||||
|
|
||||||
describe Hbc::Installer do
|
describe Hbc::Installer do
|
||||||
describe "install" do
|
describe "install" do
|
||||||
|
let(:empty_depends_on_stub) {
|
||||||
|
stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
|
||||||
|
}
|
||||||
|
|
||||||
it "downloads and installs a nice fresh Cask" do
|
it "downloads and installs a nice fresh Cask" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc.load("local-caffeine")
|
||||||
|
|
||||||
@ -44,12 +48,12 @@ describe Hbc::Installer do
|
|||||||
it "works with cab-based Casks" do
|
it "works with cab-based Casks" do
|
||||||
skip("cabextract not installed") if which("cabextract").nil?
|
skip("cabextract not installed") if which("cabextract").nil?
|
||||||
asset = Hbc.load("container-cab")
|
asset = Hbc.load("container-cab")
|
||||||
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
|
|
||||||
asset.stubs(:depends_on).returns(empty)
|
|
||||||
|
|
||||||
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
dest_path = Hbc.caskroom.join("container-cab", asset.version)
|
dest_path = Hbc.caskroom.join("container-cab", asset.version)
|
||||||
dest_path.must_be :directory?
|
dest_path.must_be :directory?
|
||||||
@ -74,12 +78,12 @@ describe Hbc::Installer do
|
|||||||
it "works with 7z-based Casks" do
|
it "works with 7z-based Casks" do
|
||||||
skip("unar not installed") if which("unar").nil?
|
skip("unar not installed") if which("unar").nil?
|
||||||
asset = Hbc.load("container-7z")
|
asset = Hbc.load("container-7z")
|
||||||
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
|
|
||||||
asset.stubs(:depends_on).returns(empty)
|
|
||||||
|
|
||||||
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
dest_path = Hbc.caskroom.join("container-7z", asset.version)
|
dest_path = Hbc.caskroom.join("container-7z", asset.version)
|
||||||
dest_path.must_be :directory?
|
dest_path.must_be :directory?
|
||||||
@ -103,12 +107,12 @@ describe Hbc::Installer do
|
|||||||
it "works with Stuffit-based Casks" do
|
it "works with Stuffit-based Casks" do
|
||||||
skip("unar not installed") if which("unar").nil?
|
skip("unar not installed") if which("unar").nil?
|
||||||
asset = Hbc.load("container-sit")
|
asset = Hbc.load("container-sit")
|
||||||
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
|
|
||||||
asset.stubs(:depends_on).returns(empty)
|
|
||||||
|
|
||||||
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
dest_path = Hbc.caskroom.join("container-sit", asset.version)
|
dest_path = Hbc.caskroom.join("container-sit", asset.version)
|
||||||
dest_path.must_be :directory?
|
dest_path.must_be :directory?
|
||||||
@ -119,12 +123,12 @@ describe Hbc::Installer do
|
|||||||
it "works with RAR-based Casks" do
|
it "works with RAR-based Casks" do
|
||||||
skip("unar not installed") if which("unar").nil?
|
skip("unar not installed") if which("unar").nil?
|
||||||
asset = Hbc.load("container-rar")
|
asset = Hbc.load("container-rar")
|
||||||
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
|
|
||||||
asset.stubs(:depends_on).returns(empty)
|
|
||||||
|
|
||||||
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
dest_path = Hbc.caskroom.join("container-rar", asset.version)
|
dest_path = Hbc.caskroom.join("container-rar", asset.version)
|
||||||
dest_path.must_be :directory?
|
dest_path.must_be :directory?
|
||||||
@ -161,12 +165,12 @@ describe Hbc::Installer do
|
|||||||
it "works with pure xz-based Casks" do
|
it "works with pure xz-based Casks" do
|
||||||
skip("unxz not installed") if which("unxz").nil?
|
skip("unxz not installed") if which("unxz").nil?
|
||||||
asset = Hbc.load("container-xz")
|
asset = Hbc.load("container-xz")
|
||||||
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
|
|
||||||
asset.stubs(:depends_on).returns(empty)
|
|
||||||
|
|
||||||
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
dest_path = Hbc.caskroom.join("container-xz", asset.version)
|
dest_path = Hbc.caskroom.join("container-xz", asset.version)
|
||||||
dest_path.must_be :directory?
|
dest_path.must_be :directory?
|
||||||
@ -177,12 +181,12 @@ describe Hbc::Installer do
|
|||||||
it "works with lzma-based Casks" do
|
it "works with lzma-based Casks" do
|
||||||
skip("unlzma not installed") if which("unlzma").nil?
|
skip("unlzma not installed") if which("unlzma").nil?
|
||||||
asset = Hbc.load("container-lzma")
|
asset = Hbc.load("container-lzma")
|
||||||
empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
|
|
||||||
asset.stubs(:depends_on).returns(empty)
|
|
||||||
|
|
||||||
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
dest_path = Hbc.caskroom.join("container-lzma", asset.version)
|
dest_path = Hbc.caskroom.join("container-lzma", asset.version)
|
||||||
dest_path.must_be :directory?
|
dest_path.must_be :directory?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user