diff --git a/test/cask/artifact/suite_test.rb b/test/cask/artifact/suite_test.rb new file mode 100644 index 000000000000..ec91021b0ead --- /dev/null +++ b/test/cask/artifact/suite_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +describe Cask::Artifact::Suite do + let(:cask) { + Cask.load('with-suite').tap do |cask| + TestHelper.install_without_artifacts(cask) + end + } + let(:expected_path) { + Cask.appdir/'caffeine_suite' + } + + it "links the suite to the proper directory" do + shutup do + Cask::Artifact::Suite.new(cask).install_phase + end + + TestHelper.valid_alias?(expected_path).must_equal true + end + + it "creates a suite containing the expected app" do + shutup do + Cask::Artifact::Suite.new(cask).install_phase + end + + expected_path.join('Caffeine.app').must_be :exist? + end + + it "avoids clobbering an existing suite by linking over it" do + FileUtils.touch expected_path + + shutup do + Cask::Artifact::Suite.new(cask).install_phase + end + + expected_path.wont_be :symlink? + end + + it "clobbers an existing symlink" do + expected_path.make_symlink('/tmp') + + shutup do + Cask::Artifact::Suite.new(cask).install_phase + end + + File.readlink(expected_path).wont_equal '/tmp' + end +end diff --git a/test/support/Casks/with-suite.rb b/test/support/Casks/with-suite.rb new file mode 100644 index 000000000000..2554243fa734 --- /dev/null +++ b/test/support/Casks/with-suite.rb @@ -0,0 +1,9 @@ +class WithSuite < TestCask + version '1.2.3' + sha256 'd1302a0dc25aff72ad395ed01a830468b92253ffd28269574f3ac0b5eb8aad54' + + url TestHelper.local_binary_url('caffeine_suite.zip') + homepage 'http://example.com/with-suite' + + suite 'caffeine_suite' +end diff --git a/test/support/binaries/caffeine_suite.zip b/test/support/binaries/caffeine_suite.zip new file mode 100644 index 000000000000..7fa5c958e5c3 Binary files /dev/null and b/test/support/binaries/caffeine_suite.zip differ