2016-08-18 22:11:42 +03:00
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
describe Hbc::Artifact::Suite do
|
2016-10-19 16:42:31 -04:00
|
|
|
let(:cask) { Hbc.load("with-suite") }
|
|
|
|
|
2016-10-23 14:30:32 +02:00
|
|
|
let(:install_phase) { -> { Hbc::Artifact::Suite.new(cask).install_phase } }
|
2016-10-19 16:42:31 -04:00
|
|
|
|
|
|
|
let(:target_path) { Hbc.appdir.join("Caffeine") }
|
2016-08-20 05:08:16 +02:00
|
|
|
let(:source_path) { cask.staged_path.join("Caffeine") }
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2016-10-19 16:42:31 -04:00
|
|
|
before do
|
|
|
|
TestHelper.install_without_artifacts(cask)
|
|
|
|
end
|
|
|
|
|
2016-08-18 22:11:42 +03:00
|
|
|
it "moves the suite to the proper directory" do
|
|
|
|
shutup do
|
2016-10-19 16:42:31 -04:00
|
|
|
install_phase.call
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
2016-10-19 16:42:31 -04:00
|
|
|
target_path.must_be :directory?
|
|
|
|
TestHelper.valid_alias?(target_path).must_equal false
|
|
|
|
source_path.wont_be :exist?
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "creates a suite containing the expected app" do
|
|
|
|
shutup do
|
2016-10-19 16:42:31 -04:00
|
|
|
install_phase.call
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
2016-10-19 16:42:31 -04:00
|
|
|
target_path.join("Caffeine.app").must_be :exist?
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "avoids clobbering an existing suite by moving over it" do
|
2016-10-19 16:42:31 -04:00
|
|
|
target_path.mkpath
|
2016-08-18 22:11:42 +03:00
|
|
|
|
|
|
|
shutup do
|
2016-10-19 16:42:31 -04:00
|
|
|
install_phase.call
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
2016-10-19 16:42:31 -04:00
|
|
|
source_path.must_be :directory?
|
|
|
|
target_path.must_be :directory?
|
|
|
|
File.identical?(source_path, target_path).must_equal false
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|