From f550a1626635d25fdcb17492fc4c8bd576b6c4db Mon Sep 17 00:00:00 2001 From: Claudia Date: Wed, 1 Jun 2016 22:38:08 +0200 Subject: [PATCH] Uncomment failing `zap` test (run `rake test:zap`) --- Rakefile | 8 +++++++ test/cask/cli/zap_test.rb | 49 ++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Rakefile b/Rakefile index 05fd6e7046cd1..b86a692cdb456 100644 --- a/Rakefile +++ b/Rakefile @@ -21,6 +21,14 @@ namespace :test do ENV['COVERAGE'] = '1' Rake::Task[:test].invoke end + + desc '[DEBUG] Run test case for `zap`' + task :zap do + ENV['TEST'] = 'test/cask/cli/zap_test' + ENV['TESTOPTS'] = + "-n'/dispatches both uninstall and zap stanzas/' -v" + Rake::Task[:test].invoke + end end desc 'Run tests for minitest and RSpec' diff --git a/test/cask/cli/zap_test.rb b/test/cask/cli/zap_test.rb index 7c17bcc2af67d..12db9178c9243 100644 --- a/test/cask/cli/zap_test.rb +++ b/test/cask/cli/zap_test.rb @@ -33,30 +33,31 @@ # todo # Explicit test that both zap and uninstall directives get dispatched. # The above tests that implicitly. - # - # it "dispatches both uninstall and zap stanzas" do - # with_zap = Hbc.load('with-zap') - # - # shutup do - # Hbc::Installer.new(with_zap).install - # end - # - # with_zap.must_be :installed? - # - # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app"'], '1') - # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application id "my.fancy.package.app" to quit']) - # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app.from.uninstall"'], '1') - # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application id "my.fancy.package.app.from.uninstall" to quit']) - # - # Hbc::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', with_zap.staged_path.join('MyFancyPkg','FancyUninstaller.tool'), '--please']) - # Hbc::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rm', '-rf', '--', - # Pathname.new('~/Library/Preferences/my.fancy.app.plist').expand_path]) - # - # shutup do - # Hbc::CLI::Zap.run('with-zap') - # end - # with_zap.wont_be :installed? - # end + + it "dispatches both uninstall and zap stanzas" do + with_zap = Hbc.load('with-zap') + + # shutup do + Hbc::Installer.new(with_zap, + command: Hbc::NeverSudoSystemCommand).install + # end + + with_zap.must_be :installed? + + # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app"'], '1') + # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application id "my.fancy.package.app" to quit']) + # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app.from.uninstall"'], '1') + # Hbc::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application id "my.fancy.package.app.from.uninstall" to quit']) + # + # Hbc::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', with_zap.staged_path.join('MyFancyPkg','FancyUninstaller.tool'), '--please']) + # Hbc::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rm', '-rf', '--', + # Pathname.new('~/Library/Preferences/my.fancy.app.plist').expand_path]) + # + # shutup do + # Hbc::CLI::Zap.run('with-zap') + # end + # with_zap.wont_be :installed? + end describe "when no Cask is specified" do it "raises an exception" do