aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/spec
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-09 03:19:24 +0100
committerMarkus Reiter2017-02-10 17:19:19 +0100
commited197c6f82e8f8aafa07a98f60ddf6bf64964884 (patch)
treed3fa083de8bdf75b4ab5f66dbc7ef4fc90901a62 /Library/Homebrew/cask/spec
parentc431758f2dff931b69b16ab412dabacbe77380c0 (diff)
downloadbrew-ed197c6f82e8f8aafa07a98f60ddf6bf64964884.tar.bz2
Convert Suite test to spec.
Diffstat (limited to 'Library/Homebrew/cask/spec')
-rw-r--r--Library/Homebrew/cask/spec/cask/artifact/suite_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/spec/cask/artifact/suite_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/suite_spec.rb
new file mode 100644
index 000000000..79ca0546c
--- /dev/null
+++ b/Library/Homebrew/cask/spec/cask/artifact/suite_spec.rb
@@ -0,0 +1,49 @@
+require "spec_helper"
+
+describe Hbc::Artifact::Suite 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 } }
+
+ let(:target_path) { Hbc.appdir.join("Caffeine") }
+ let(:source_path) { cask.staged_path.join("Caffeine") }
+
+ before(:each) do
+ InstallHelper.install_without_artifacts(cask)
+ end
+
+ it "moves the suite to the proper directory" do
+ skip("flaky test") # FIXME
+
+ shutup do
+ install_phase.call
+ end
+
+ expect(target_path).to be_a_directory
+ expect(target_path).to be_a_symlink
+ expect(target_path.readlink).to exist
+ expect(source_path).not_to exist
+ end
+
+ it "creates a suite containing the expected app" do
+ shutup do
+ install_phase.call
+ end
+
+ expect(target_path.join("Caffeine.app")).to exist
+ end
+
+ it "avoids clobbering an existing suite by moving over it" do
+ target_path.mkpath
+
+ expect {
+ shutup do
+ install_phase.call
+ end
+ }.to raise_error(Hbc::CaskError)
+
+ expect(source_path).to be_a_directory
+ expect(target_path).to be_a_directory
+ expect(File.identical?(source_path, target_path)).to be false
+ end
+end