2017-03-05 19:26:56 +01:00
|
|
|
describe Hbc::Artifact::PreflightBlock, :cask do
|
2016-08-18 22:11:42 +03:00
|
|
|
describe "install_phase" do
|
|
|
|
it "calls the specified block before installing, passing a Cask mini-dsl" do
|
2017-02-08 10:09:00 +01:00
|
|
|
called = false
|
2016-08-18 22:11:42 +03:00
|
|
|
yielded_arg = nil
|
|
|
|
|
|
|
|
cask = Hbc::Cask.new("with-preflight") do
|
|
|
|
preflight do |c|
|
|
|
|
called = true
|
|
|
|
yielded_arg = c
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-08 10:09:00 +01:00
|
|
|
described_class.new(cask).install_phase
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 10:09:00 +01:00
|
|
|
expect(called).to be true
|
|
|
|
expect(yielded_arg).to be_kind_of Hbc::DSL::Preflight
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "uninstall_phase" do
|
|
|
|
it "calls the specified block before uninstalling, passing a Cask mini-dsl" do
|
2017-02-08 10:09:00 +01:00
|
|
|
called = false
|
2016-08-18 22:11:42 +03:00
|
|
|
yielded_arg = nil
|
|
|
|
|
|
|
|
cask = Hbc::Cask.new("with-uninstall-preflight") do
|
|
|
|
uninstall_preflight do |c|
|
|
|
|
called = true
|
|
|
|
yielded_arg = c
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-08 10:09:00 +01:00
|
|
|
described_class.new(cask).uninstall_phase
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 10:09:00 +01:00
|
|
|
expect(called).to be true
|
|
|
|
expect(yielded_arg).to be_kind_of Hbc::DSL::UninstallPreflight
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|