Extract tests specific to uninstall :quit

This commit is contained in:
Josh Hagins 2016-01-02 20:09:25 -05:00
parent fd9650d875
commit c1bb87e2ac
2 changed files with 30 additions and 1 deletions

View File

@ -196,7 +196,25 @@ describe Hbc::Artifact::Uninstall do
end
describe 'when using quit' do
# todo
let(:cask) { Hbc.load('with-uninstall-quit') }
let(:bundle_id) { 'my.fancy.package.app' }
let(:count_processes_script) {
'tell application "System Events" to count processes ' +
%Q{whose bundle identifier is "#{bundle_id}"}
}
let(:quit_application_script) {
%Q{tell application id "#{bundle_id}" to quit}
}
it 'can uninstall' do
Hbc::FakeSystemCommand.stubs_command(
sudo(%W[/usr/bin/osascript -e #{count_processes_script}]), '1')
Hbc::FakeSystemCommand.stubs_command(
sudo(%W[/usr/bin/osascript -e #{quit_application_script}]))
subject
end
end
describe 'when using signal' do

View File

@ -0,0 +1,11 @@
test_cask 'with-uninstall-quit' do
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
url TestHelper.local_binary_url('MyFancyPkg.zip')
homepage 'http://example.com/fancy-pkg'
pkg 'MyFancyPkg/Fancy.pkg'
uninstall :quit => 'my.fancy.package.app'
end