Skip to content

Commit

Permalink
add missing test coverage for suite artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandwalker committed Nov 18, 2014
1 parent a21dbc8 commit 000e251
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
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.

0 comments on commit 000e251

Please sign in to comment.