Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing test coverage for suite artifact #7432

Merged
merged 1 commit into from
Nov 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions test/cask/artifact/suite_test.rb
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions test/support/Casks/with-suite.rb
Original file line number Diff line number Diff line change
@@ -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
Binary file added test/support/binaries/caffeine_suite.zip
Binary file not shown.