aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/test
diff options
context:
space:
mode:
authorJosh Hagins2016-10-23 21:38:39 -0400
committerGitHub2016-10-23 21:38:39 -0400
commit49155cce4d729a4bd12c3486f4e6e2b60cdc33c9 (patch)
tree93c3e8f8e4be8642763b5e6fb479e30011903888 /Library/Homebrew/cask/test
parentc551252da2a33cef53468d5dec857b99be82c118 (diff)
parent4a9b48e9a61a000bb9a415bd1189347a937c195b (diff)
downloadbrew-49155cce4d729a4bd12c3486f4e6e2b60cdc33c9.tar.bz2
Merge pull request #1360 from reitermarkus/refactor-installer-test
Refactor Installer test.
Diffstat (limited to 'Library/Homebrew/cask/test')
-rw-r--r--Library/Homebrew/cask/test/cask/installer_test.rb52
1 files changed, 28 insertions, 24 deletions
diff --git a/Library/Homebrew/cask/test/cask/installer_test.rb b/Library/Homebrew/cask/test/cask/installer_test.rb
index f64ed8c17..d76411ae6 100644
--- a/Library/Homebrew/cask/test/cask/installer_test.rb
+++ b/Library/Homebrew/cask/test/cask/installer_test.rb
@@ -2,6 +2,10 @@ require "test_helper"
describe Hbc::Installer 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
caffeine = Hbc.load("local-caffeine")
@@ -44,11 +48,11 @@ describe Hbc::Installer do
it "works with cab-based Casks" do
skip("cabextract not installed") if which("cabextract").nil?
asset = Hbc.load("container-cab")
- empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
- asset.stubs(:depends_on).returns(empty)
- shutup do
- Hbc::Installer.new(asset).install
+ asset.stub :depends_on, empty_depends_on_stub do
+ shutup do
+ Hbc::Installer.new(asset).install
+ end
end
dest_path = Hbc.caskroom.join("container-cab", asset.version)
@@ -74,11 +78,11 @@ describe Hbc::Installer do
it "works with 7z-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc.load("container-7z")
- empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
- asset.stubs(:depends_on).returns(empty)
- shutup do
- Hbc::Installer.new(asset).install
+ asset.stub :depends_on, empty_depends_on_stub do
+ shutup do
+ Hbc::Installer.new(asset).install
+ end
end
dest_path = Hbc.caskroom.join("container-7z", asset.version)
@@ -103,11 +107,11 @@ describe Hbc::Installer do
it "works with Stuffit-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc.load("container-sit")
- empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
- asset.stubs(:depends_on).returns(empty)
- shutup do
- Hbc::Installer.new(asset).install
+ asset.stub :depends_on, empty_depends_on_stub do
+ shutup do
+ Hbc::Installer.new(asset).install
+ end
end
dest_path = Hbc.caskroom.join("container-sit", asset.version)
@@ -119,11 +123,11 @@ describe Hbc::Installer do
it "works with RAR-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc.load("container-rar")
- empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
- asset.stubs(:depends_on).returns(empty)
- shutup do
- Hbc::Installer.new(asset).install
+ asset.stub :depends_on, empty_depends_on_stub do
+ shutup do
+ Hbc::Installer.new(asset).install
+ end
end
dest_path = Hbc.caskroom.join("container-rar", asset.version)
@@ -161,11 +165,11 @@ 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")
- empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
- asset.stubs(:depends_on).returns(empty)
- shutup do
- Hbc::Installer.new(asset).install
+ asset.stub :depends_on, empty_depends_on_stub do
+ shutup do
+ Hbc::Installer.new(asset).install
+ end
end
dest_path = Hbc.caskroom.join("container-xz", asset.version)
@@ -177,11 +181,11 @@ describe Hbc::Installer do
it "works with lzma-based Casks" do
skip("unlzma not installed") if which("unlzma").nil?
asset = Hbc.load("container-lzma")
- empty = stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
- asset.stubs(:depends_on).returns(empty)
- shutup do
- Hbc::Installer.new(asset).install
+ asset.stub :depends_on, empty_depends_on_stub do
+ shutup do
+ Hbc::Installer.new(asset).install
+ end
end
dest_path = Hbc.caskroom.join("container-lzma", asset.version)