31 lines
863 B
Ruby
Raw Normal View History

2017-03-05 19:26:56 +01:00
describe Hbc::Artifact::Suite, :cask do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-suite.rb") }
2016-10-23 14:30:32 +02:00
let(:install_phase) { -> { Hbc::Artifact::Suite.new(cask).install_phase } }
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
2017-02-09 03:19:24 +01:00
before(:each) do
InstallHelper.install_without_artifacts(cask)
end
2016-08-18 22:11:42 +03:00
it "creates a suite containing the expected app" do
2017-07-29 19:55:05 +02:00
install_phase.call
2016-08-18 22:11:42 +03:00
2017-02-09 03:19:24 +01:00
expect(target_path.join("Caffeine.app")).to exist
2016-08-18 22:11:42 +03:00
end
it "avoids clobbering an existing suite by moving over it" do
target_path.mkpath
2016-08-18 22:11:42 +03:00
2017-02-09 03:19:24 +01:00
expect {
2017-07-29 19:55:05 +02:00
install_phase.call
2017-02-09 03:19:24 +01:00
}.to raise_error(Hbc::CaskError)
2016-08-18 22:11:42 +03:00
2017-02-09 03:19:24 +01:00
expect(source_path).to be_a_directory
expect(target_path).to be_a_directory
expect(File.identical?(source_path, target_path)).to be false
2016-08-18 22:11:42 +03:00
end
end